ResizableScreen
A split-pane layout component that allows users to resize two panels by dragging a handle, with keyboard accessibility support.
Import
Usage
Examples
Basic horizontal split
Panel 1
Panel 2
Vertical split
Top Panel
Bottom Panel
Controlled size
Controlled Panel (40%)
Secondary Panel
With default size
Larger Panel
Smaller Panel
Min and max size
Panel (30-70%)
Panel
Handle styling
Styled Handle
Panel
Hide handle
No visible handle
(Resize still possible via keyboard)
Custom step size
Step 5%
Panel
Custom handle className
Custom Handle
Panel
With code editor layout
// Editor Panel
const hello = "world";
Preview
Rendered content here...
Nested resizable screens
Top Left
Bottom Left
Right Panel
Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | [ReactNode, ReactNode] | None | Exactly two panel elements (required) |
size | number (0-100) | None | Controlled size percentage for primary panel |
defaultSize | number (0-100) | 50* | Initial size for uncontrolled state |
left | number (0-100) | None | Alias for defaultSize |
minSize | number (0-100) | 20* | Minimum percentage for primary panel |
maxSize | number (0-100) | 80* | Maximum percentage for primary panel |
step | number | 2* | Step size for keyboard arrow keys |
orientation | "horizontal" | "vertical" | "horizontal"* | Layout direction |
handleVariant | "solid" | "ghost" | "bordered" | "faded" | "underlined" | "bordered"* | Visual style of handle |
handleColor | "none" | "default" | "primary" | "secondary" | "danger" | "warning" | "success" | "primary"* | Handle color |
handleRadius | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "full" | "full"* | Handle corner rounding |
hideHandle | boolean | false* | Hide the visual handle |
onSizeChange | (size: number) => void | None | Callback when size changes |
handleClassName | string | None | Extra classes for handle container |
className | string | None | Extra classes, merged with internal styles |
* Falls back through Global Configuration if not set. See below.
Global Configuration
ResizableScreen reads defaults from four places, in this order of precedence:
- Instance prop: set directly on
<ResizableScreen /> - Component config:
components.resizableScreenin yourashee.config - Theme default:
defaultVariant/defaultColor/defaultRadiusin yourashee.config - Built-in fallback: component's internal default values
Component config
Built-in fallbacks
Accessibility
- Uses
role="separator"for the resize handle - Supports keyboard navigation with arrow keys (Left/Right for horizontal, Up/Down for vertical)
- Supports Home (min) and End (max) keys
- Includes
aria-valuenow,aria-valuemin, andaria-valuemaxattributes - Uses
aria-orientationto indicate resize direction - Implements
focus-visiblerings for keyboard navigation - Pointer capture ensures smooth drag experience
Notes
- Children Requirement: The component expects exactly two children. Any additional children will be ignored.
- Controlled vs Uncontrolled: Use
size/onSizeChangefor controlled usage, ordefaultSizefor uncontrolled. - left Prop: The
leftprop is provided as an alias fordefaultSizefor backward compatibility. - Handle Visibility: When
hideHandleistrue, the visual handle is hidden but the resize functionality is still available via keyboard shortcuts. - Drag Performance: The component uses pointer events with pointer capture for smooth dragging performance.