ResizableScreen

ResizableScreen

A split-pane layout component that allows users to resize two panels by dragging a handle, with keyboard accessibility support.


Import

tsx
import { ResizableScreen } from "asheeui";

Usage

tsx
import { ResizableScreen } from "asheeui";
export default function Basic() {
return (
<div className="w-full h-100">
<ResizableScreen>
<div className="flex h-40 items-center justify-center p-4">
Left Panel
</div>
<div className="flex h-40 items-center justify-center p-4">
Right Panel
</div>
</ResizableScreen>
</div>
);
}

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

PropTypeDefaultDescription
children[ReactNode, ReactNode]NoneExactly two panel elements (required)
sizenumber (0-100)NoneControlled size percentage for primary panel
defaultSizenumber (0-100)50*Initial size for uncontrolled state
leftnumber (0-100)NoneAlias for defaultSize
minSizenumber (0-100)20*Minimum percentage for primary panel
maxSizenumber (0-100)80*Maximum percentage for primary panel
stepnumber2*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
hideHandlebooleanfalse*Hide the visual handle
onSizeChange(size: number) => voidNoneCallback when size changes
handleClassNamestringNoneExtra classes for handle container
classNamestringNoneExtra 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:

  1. Instance prop: set directly on <ResizableScreen />
  2. Component config: components.resizableScreen in your ashee.config
  3. Theme default: defaultVariant / defaultColor / defaultRadius in your ashee.config
  4. Built-in fallback: component's internal default values

Component config

ts
// ashee.config.ts
import type { ExternalConfig } from "asheeui";
export const config: ExternalConfig = {
components: {
resizableScreen: {
defaultSize: 50,
minSize: 20,
maxSize: 80,
step: 2,
orientation: "horizontal",
handleVariant: "bordered",
handleColor: "primary",
handleRadius: "full",
hideHandle: false,
},
},
};

Built-in fallbacks

ts
{
defaultSize: 50,
minSize: 20,
maxSize: 80,
step: 2,
orientation: "horizontal",
handleVariant: "bordered",
handleColor: "primary",
handleRadius: "full",
hideHandle: false,
className: "",
handleClassName: "",
}

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, and aria-valuemax attributes
  • Uses aria-orientation to indicate resize direction
  • Implements focus-visible rings 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/onSizeChange for controlled usage, or defaultSize for uncontrolled.
  • left Prop: The left prop is provided as an alias for defaultSize for backward compatibility.
  • Handle Visibility: When hideHandle is true, 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.
Previous

← Radio

Next

Select →