Zephora UI

Layout

Splitter

Resizable two-pane layout. A keyboard- and pointer-operable separator between two SplitterPanels resizes the first panel in percent.

Import

import { Splitter, SplitterPanel } from "@zephora/react";

Examples

Horizontal

Drag the handle or focus it and use the Arrow keys.

Sidebar
Content

Vertical

`orientation="vertical"` stacks the panels.

Editor
Console

Controlled

Use `size` + `onSizeChange` to control the split; `minSize`/`maxSize` bound it.

50%
50%

API

Splitter props

PropTypeDefaultDescription
orientation"horizontal" | "vertical""horizontal""horizontal" places the panels side by side, "vertical" stacks them.
defaultSizenumber50Uncontrolled initial size of the first panel, in percent.
sizenumberControlled size of the first panel, in percent.
onSizeChange(size: number) => voidCalled with the new first-panel size (percent) on every resize.
minSizenumber10Lower resize bound, in percent.
maxSizenumber90Upper resize bound, in percent.
handleAriaLabelstring"Resize panels"Accessible name for the drag handle.
unstyledbooleanfalseHeadless mode — skips Zephora styling.

SplitterPanel props

PropTypeDefaultDescription
unstyledbooleanfalseHeadless mode — skips Zephora styling.
…restHTMLAttributes<HTMLDivElement>All native div props are forwarded.

Keyboard

KeyAction
Arrow keysResize by 2% steps (Left/Right when horizontal, Up/Down when vertical) while the handle is focused.
HomeResize the first panel to minSize.
EndResize the first panel to maxSize.