Resizable
Resizable percentage-based panel groups with keyboard controls and nested layouts.
Splits a container into two or more percentage-sized panels separated by draggable, keyboard-accessible resize handles, supporting constraints, collapse stops, and nested panel groups.
Preview
Section titled “Preview” Web Components React Vue Vue 2
Loading interactive preview… The article and source are ready to read. Interactive controls will appear here when ready.
Installation
Section titled “Installation”Available starting in 0.3.0-rc.1 and later releases.
Compose Root, Panel, and Handle:
- Indexing panels and handles: Provide
Npanels withindex: 0..N-1andN-1handles withindex: 0..N-2. EachHandleadjusts only its adjacent pair of panels while preserving every other panel’s size, and carries the default accessible nameResize panels. - Sizing and layout:
sizes/defaultSizeshold the full percentage array summing to100(the legacy two-panelvalue/defaultValueprops remain supported, withsizestaking precedence when supplied). EachPanelexposes a dimensionlesssizestate consumed by static CSS rules via--pui-size; drag normalization uses total panel border-box length, excluding fixed handle widths. - Constraints and interaction: Pointer dragging, arrow keys,
Home/End,Shiftacceleration, and collapse stops share the same constraint solver. Pass per-panelconstraintswithmin(default0),max(default100),collapsible(defaultfalse), andcollapsedSize(default0). Infeasible layouts keep the previous valid sizes, and collapse stops respect adjacent panel maximums. - Controlled mode and nesting: Pass
sizesfor controlled layouts and listen tosizesChange/sizesCommit(payload{ sizes }). Updatesizesto accept a proposal or keep the existing value to reject it; canceled gestures do not emitsizesCommit. NestedRootinstances manage independent ratios, orientations, and constraints.
| Prop | Type | Default |
|---|---|---|
defaultValue | number | 50 |
min | number | 10 |
max | number | 90 |
step | number | 1 |
collapsible | boolean | false |
disabled | boolean | false |
readOnly | boolean | false |
orientation | 'horizontal' 'vertical' | horizontal |
direction | 'ltr' 'rtl' | ltr |
Multi-panel mode also accepts sizes, defaultSizes, and constraints. Panel and Handle accept index (default 0).
- Exposed state and methods: Read
sizes, or callrequestResize(index, nextSize, commit)/requestSizes(nextSizes, commit). - Events:
sizesChange,sizesCommit(payload{ sizes }).