Split pane

stable 2.5 kB
<hk-split>

A draggable splitter with keyboard resize and real minimum sizes, so neither pane can be collapsed into uselessness by accident.

#resize#panes
In the package npm i hellskitchen-ui Import hk-split and use it directly.

Live demo

Running in this page — interact with it.

Inputs

NameTypeDefaultDescription
splitnumber50First pane size as a percentage. Two-way bindable.
min / maxnumber10 / 90Clamp bounds, as percentages.
orientation'horizontal' | 'vertical''horizontal'Splitter direction.
stepnumber4Percentage moved per arrow-key press (← / →, or ↑ / ↓ when vertical).

Outputs

  • splitChangeEventEmitter<number>

    Emits whenever the split changes — dragging, keys or Enter.

Keyboard

  • ← / → Moves the splitter by one step
  • Home / End Jumps to the min / max bound
  • Enter Collapses the first pane to the min bound, and restores it

Theming

Component tokens, each falling back to a global one:

PropertyDefaultControls
--hk-split-handle#f1f5f9Handle colour at rest.
--hk-split-handle-active#dc2626Handle colour while dragging or focused.

Accessibility

  • The handle is role="separator" with aria-valuenow, and it is focusable — resizing is not mouse-only.
  • Clamping to min and max means a pane can never be dragged to zero width by accident.

More in Layout