Split
Two-column layout with configurable proportions that stacks to a single column when its own width gets narrow.
Import
import { Split } from "@hyzer-labs/ui"Demo
fraction is the first column's share. auto sizes the first
column to its content and gives the rest to the second. auto-end mirrors
that: the last column sizes to its content while the first takes the rest. Below the stackBelow width the columns stack. The default sm is 640px of the
Split's own width.
<Split fraction="1/2">
<div>First</div>
<div>Second</div>
</Split>reverse swaps the columns with CSS order. The DOM is
untouched, so screen readers and Tab order still follow source order. This is useful for
alternating media and text rows.
<!-- reverse swaps the columns visually only; DOM, reading, and focus order are unchanged -->
<Split fraction="1/3" reverse>
<div>DOM first (visual right)</div>
<div>DOM second (visual left)</div>
</Split>The Split stacks when its own width drops under the chosen width token (sm 640px, md 968px, lg 1200px). The threshold resolves through var(--hz-width-*), so overriding those tokens (globally or on any ancestor)
changes when it stacks. none never stacks, no matter how narrow the Split gets.
Use the slider to cross the threshold.
side by side
<Split stackBelow="sm">
<div>First</div>
<div>Second</div>
</Split>gap is the space between the two columns, and between the stacked rows
below the stackBelow width. The tinted zone is the Split; the space between
its edge and the panes is the padding. padding applies on both axes; paddingInline and paddingBlock override one axis and win where set. Both stay correct in RTL and vertical writing modes.
The padding sits on the split root, so stackBelow measures the padded-down
width. near and away are the density distances: context-aware values that
tighten inside data-density-shift regions.
<Split gap="md" padding="md">…</Split>
<Split gap="md" paddingInline="md">…</Split>
<Split gap="md" paddingBlock="md">…</Split>Props
| Name | Type | Default | Note |
|---|---|---|---|
fraction | '1/4' | '1/3' | '1/2' | '2/3' | '3/4' | 'auto' | 'auto-end' | '1/2' | 'auto' sizes the first column to its content; 'auto-end' the last (the other column grows). |
gap | 'none' | 'sm' | 'md' | 'lg' | 'near' | 'away' | 'md' | near/away are the density distances — they tighten inside data-density-shift regions. |
reverse | boolean | false | |
stackBelow | 'sm' | 'md' | 'lg' | 'none' | 'sm' | Stacks once the Split's own width falls under the --hz-width-sm/md/lg token (640/968/1200px). The threshold resolves via var(), so overriding the token retunes it. 'none' never stacks. |
padding | 'none' | 'sm' | 'md' | 'lg' | 'near' | 'away' | 'none' | Both axes, on the split root — stackBelow measures the padded-down width. Shared LayoutPadding scale. |
paddingInline | 'none' | 'sm' | 'md' | 'lg' | 'near' | 'away' | — | Per-axis override — wins over padding on the inline axis. Same LayoutPadding scale. |
paddingBlock | 'none' | 'sm' | 'md' | 'lg' | 'near' | 'away' | — | Per-axis override — wins over padding on the block axis. Same LayoutPadding scale. |
as | string | 'div' | |
class | string | — | Merged after the hz-split class. |
children | Snippet | — | Two direct children become the columns. |
Anything not listed above is forwarded as an attribute to the root element (or the native control in form components). So id, data-*, aria-*, and event handlers just work.
Theme hooks
What this component promises your CSS. The reference theme styles exactly these — from @layer hz-theme, so your unlayered rules win. See Styling Components for the how.
Root class: .hz-split
Data attributes
| Hook | Values | Styles |
|---|---|---|
data-fraction | '1/4' | '1/3' | '1/2' | '2/3' | '3/4' | 'auto' | Ratio of the two columns above the stack threshold. Default 1/2. |
data-gap | 'none' | 'sm' | 'md' | 'lg' | 'near' | 'away' | Gap between the columns. Default md. |
data-reverse | present when reversed | Visual-only swap via order — DOM and focus order are preserved. |
data-stack-below | 'sm' | 'md' | 'lg' | Picks which --hz-width-* token the stack threshold resolves through, so overriding that token retunes when the split stacks. Default sm. |
data-padding | 'none' | 'sm' | 'md' | 'lg' | 'near' | 'away' | Padding, applied to the root. Default none. |
Part classes
| Hook | Values | Styles |
|---|---|---|
.hz-split-layout | child element | The flex row. Carries the gap; the fraction and order rules reach your two children through it. |
Accessibility
Split is a layout primitive with no ARIA semantics. DOM order determines reading and focus order regardless of visual arrangement.