Skip to content

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.

fraction
First
Second
<Split fraction="1/2">
	<div>First</div>
	<div>Second</div>
</Split>

Props

NameTypeDefaultNote
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.
reversebooleanfalse
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.
asstring'div'
classstring—Merged after the hz-split class.
childrenSnippet—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

HookValuesStyles
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-reversepresent when reversedVisual-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

HookValuesStyles
.hz-split-layoutchild elementThe 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.