Resizable panels
Resizable panels component with draggable and keyboard accessible handles, size limits, horizontal and vertical layouts.
How to use it
Run npx @blossomui/react add resizable, or copy src/components/UI/Resizable/Resizable.tsx into your React project and import it.
import { ResizablePanels } from './components/ui/Resizable'Props
ResizablePanel
| Prop | Type | Description |
|---|---|---|
| id (required) | string | |
| content (required) | ReactNode | |
| defaultSize | number | Starting size, as a percentage of the space. Panels without it share what is left. |
| minSize | number | Smallest size, as a percentage. |
| maxSize | number | Largest size, as a percentage. |
ResizablePanelsProps
| Prop | Type | Description |
|---|---|---|
| panels (required) | ResizablePanel[] | |
| direction | 'horizontal' | 'vertical' | `horizontal` puts the panels side by side, `vertical` stacks them. |
| onResize | (sizes: number[]) => void | Called with the size of every panel, in percentage, while the user resizes. |
| withHandle | boolean | Show a small grip in the middle of each handle. |
| color | string | Accent color of the handle when it is used: any CSS color. Without it the component uses `--blossom-accent`. |
| handleLabel | string | Accessible name of the handles. |
| className | string | Give it a height, for example `h-72`. The panels fill it. |