Skip to content
Alea0.1

Layout

Splitter

Two panes with a handle to resize them, by dragging or with the keyboard.

Ant Design: Splitter

import { Splitter } from '@alea/ui';

Examples

Splitter

Drag the handle, or focus it and use the arrows.

Layers

Header, Hero, Pricing

Canvas

The selected frame

Vertical

Stacked panes: code on top, preview below.

Code

Preview

Props

Splitter props

Two panes with a handle between them: drag it, or focus it and use the arrow keys (Ant's Splitter).

PropTypeDefaultDescription
childrenrequired[ReactNode, ReactNode]-The two panes.
aria-labelstring-Name of the handle for screen readers. Default "Resize".
classNamestring-Extra class names for the root element.
defaultSizenumber50Starting size of the first pane in percent. Default 50.
maxnumber85Largest size of the first panel, in %. Default 85.
minnumber15Smallest and largest first pane, in percent. Default 15 and 85.
onSizeChange((size: number) => void)-Called with the first panel's size in %.
orientation"horizontal" | "vertical"'horizontal'horizontal: side by side (default); vertical: stacked.
sizenumber-Size of the first pane in percent (controlled).
styleCSSProperties-Inline styles for the root element.

Accessibility

  • The handle is a focusable separator with its size as a value.

Keyboard

KeyDoes
Arrow keysResize by 2%
Shift + arrowsResize by 10%
Home / EndSmallest / largest
EnterBack to the default size

Do and don't

Do

  • Set min and max so panels never disappear.
  • Give the separator an aria-label that says what it resizes.

Don't

  • Don't use it on phones: stack the panels instead.
  • Don't save sizes the person can't reset (Enter resets).
Tested with axe, keyboard and screen reader roles