elementsresizable
Resizable
Resizable panel layout with draggable dividers and keyboard support.
Import#
Slot Structure#
Panels separated by interactive dividers with optional handle and intersection targets.
Examples#
Basic Horizontal#
Two panels with auto-inserted divider and root-level handle rendering.
Controlled Sizes#
Use panel.size + onResize to sync external state. The callback now returns pixel sizes.
Vertical + Disable#
The root disable prop keeps dividers visible while turning off drag and keyboard resizing.
Nested Panels#
Use the root intersection prop to control whether crossed dividers become draggable.
Collapsible + Collapsible Min#
Clicking handle toggles collapse/expand while dragging divider still resizes. The collapsibleMin rail remains visible in collapsed state.
API Reference#
Attributes#
Slot
root2 attributesLayout container that owns resizable panels and handles.
Data Attributes
| Data Attribute | Description |
|---|---|
| data-orientation | Stores the rendered orientation. |
| data-resizable-root | State or slot attribute exposed for styling hooks and selectors. |
Props#
| Prop | Type | Default | Description |
|---|---|---|---|
| class | ClassValue | — | Class applied to the component root or trigger element. |
| classes | ResizableT.Classes | undefined | — | — |
| disable | boolean | undefined | false | Whether the resizable component is disabled. |
| handle | boolean | undefined | true | Whether to render handles between panels. |
| handleAction | "resize" | "collapse" | undefined | resize | Handle interaction behavior.
- `resize`: handle area follows divider resize interactions.
- `collapse`: handle click toggles the nearest collapsible panel. |
| handleRender | ComponentOrElement<ResizableT.HandleRenderProps> | undefined | — | Custom component rendered inside each handle. |
| id | string | undefined | — | Unique identifier for the resizable root. |
| intersection | boolean | undefined | false | Whether to use intersection-based handle sizing. |
| keyboardDelta | ResizableSize | undefined | 10% | The amount to resize when using keyboard shortcuts. |
| onHandleKeyDown | ((context: { event: KeyboardEvent; handleIndex: number; sizes: number[]; }) => void) | undefined | — | Callback when a key is pressed on a handle. |
| onResize | ((sizes: number[]) => void) | undefined | — | Callback when any panel is resized. |
| onResizeEnd | ((sizes: number[]) => void) | undefined | — | Callback when a resize operation ends. |
| onResizeStart | ((sizes: number[]) => void) | undefined | — | Callback when a resize operation starts. |
| orientation | "horizontal" | "vertical" | undefined | — | — |
| panels | ResizableT.Item[] | undefined | — | Array of panels to render. |
| ref | JSX.HTMLElementTags["div"] extends { ref?: infer Ref; } ? Ref : never | undefined | — | — |
| style | JSX.CSSProperties | undefined | — | — |
| styles | ResizableT.Styles | undefined | — | — |
Items#
| Prop | Type | Default | Description |
|---|---|---|---|
| class | string | undefined | — | Additional CSS classes for the panel. |
| collapsible | boolean | undefined | false | Whether the panel is collapsible.
This prop is reactive; toggling `true/false` can be used as a simple collapse signal. |
| collapsibleMin | ResizableSize | undefined | 0 | Size of the panel when collapsed.
Only works when `collapsible` is true.
- Use string as percent, like `20%`
- Use number as px, like `328` |
| content | JSX.Element | — | Content to render inside the panel. |
| defaultSize | ResizableSize | undefined | — | Default size of the panel (uncontrolled).
- Use string as percent, like `20%`
- Use number as px, like `328` |
| max | ResizableSize | undefined | 1 | Maximum size of the panel.
- Use string as percent, like `20%`
- Use number as px, like `328` |
| min | ResizableSize | undefined | 0 | Minimum size of the panel.
- Use string as percent, like `20%`
- Use number as px, like `328` |
| onCollapse | ((size: number) => void) | undefined | — | Callback when the panel is collapsed. |
| onExpand | ((size: number) => void) | undefined | — | Callback when the panel is expanded. |
| onResize | ((size: number) => void) | undefined | — | Callback when the panel is resized. |
| panelId | string | undefined | — | Unique identifier for the panel. |
| resizable | boolean | undefined | true | Whether the panel is resizable. |
| size | ResizableSize | undefined | — | Current size of the panel (controlled).
- Use string as percent, like `20%`
- Use number as px, like `328` |
| style | JSX.CSSProperties | undefined | — | Additional CSS styles for the panel. |