Layout
Resizable
Split panes — panels side by side (or stacked) with draggable, keyboard-operable boundaries between them. The editor/preview layout, the sidebar you can widen, the inspector you can shrink.
Import
import { Resizable, ResizableHandle, ResizablePanel } from '@the_viveksingh/vivek-ui'Editor and sidebar
Each handle is a role="separator" with a value: aria-valuenow is the share of the panel before it, arrows move it by step percent (Shift x 5), Home/End go to the limits, Enter or a double-click resets. Dragging uses pointer capture. Shares always sum to 100 and are remembered per storageKey.
<Resizable defaultSizes={[25, 75]} storageKey="workspace-split">
<Resizable.Panel minSize={15} maxSize={50}>
<FileTree nodes={files} label="Files" />
</Resizable.Panel>
<Resizable.Handle label="Resize the file list" />
<Resizable.Panel>
<Editor />
</Resizable.Panel>
</Resizable>Nested and controlled
orientation="vertical" stacks panels; a Resizable inside a panel nests. sizes / onSizesChange make it controlled - here the terminal share is kept in state so a "Hide terminal" button can set it to its minimum.
<Resizable orientation="vertical" sizes={split} onSizesChange={setSplit}>
<Resizable.Panel minSize={30}>
<Editor />
</Resizable.Panel>
<Resizable.Handle label="Resize the terminal" />
<Resizable.Panel minSize={10}>
<Terminal />
</Resizable.Panel>
</Resizable>
<Button variant="ghost" onClick={() => setSplit([90, 10])}>Hide terminal</Button>Props
Generated from the package's own type declarations, so this table cannot drift from the code.
| Prop | Type | Default | Description |
|---|---|---|---|
orientation | ResizableOrientation | — | `horizontal` lays panels side by side (the default); `vertical` stacks them. |
sizes | number[] | — | Controlled panel shares, in percent. Normalised to sum to 100. |
defaultSizes | number[] | — | Initial shares. Default: an equal split. |
onSizesChange | (sizes: number[]) => void | — | — |
step | number | — | Percent moved per arrow key. Shift multiplies by five. Default `2`. |
storageKey | string | — | Persist the layout in `localStorage` under this key. |
children | ReactNode | — | — |
Every remaining prop is spread onto the root element, so all standard HTML and ARIA attributes work. className and style are merged with the library's own, never replaced, and the ref forwards to the root DOM node.
Exports
ResizableResizableHandleResizablePanelRendering
Resizable declares 'use client' because it needs state, effects or event handlers. Importing it into a Server Component creates a client boundary at this component — everything above it stays on the server.