Installation
Add Component
Copy the code snippet below into you components folder.
Integrate Recipe
Integrate this recipe in to your Panda config.
Usage
Examples
Collapsible
Set collapsible to true on a panel to make it collapsible. Use collapsedSize to control its collapsed size. This can be useful for building sidebar layouts.
Vertical
Use the orientation prop to create a vertical splitter.
Multiple
Here is an example with multiple panels.
Store
Use the useSplitter hook to control the state of the splitter programmatically.
Props
Root
| Prop | Default | Type | 
|---|---|---|
| panels* | PanelData[]The size constraints of the panels. | |
| orientation | \horizontal\ | 'horizontal' | 'vertical'The orientation of the splitter. Can be `horizontal` or `vertical` | 
| asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. | |
| defaultSize | number[]The initial size of the panels when rendered. Use when you don't need to control the size of the panels. | |
| id | stringThe unique identifier of the machine. | |
| ids | Partial<{
  root: string
  resizeTrigger: (id: string) => string
  label: (id: string) => string
  panel: (id: string | number) => string
}>The ids of the elements in the splitter. Useful for composition. | |
| keyboardResizeBy | numberThe number of pixels to resize the panel by when the keyboard is used. | |
| nonce | stringThe nonce for the injected splitter cursor stylesheet. | |
| onCollapse | (details: ExpandCollapseDetails) => voidFunction called when a panel is collapsed. | |
| onExpand | (details: ExpandCollapseDetails) => voidFunction called when a panel is expanded. | |
| onResize | (details: ResizeDetails) => voidFunction called when the splitter is resized. | |
| onResizeEnd | (details: ResizeEndDetails) => voidFunction called when the splitter resize ends. | |
| onResizeStart | () => voidFunction called when the splitter resize starts. | |
| size | number[]The controlled size data of the panels | 
Panel
| Prop | Default | Type | 
|---|---|---|
| id* | string | |
| asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. | 
ResizeTrigger
| Prop | Default | Type | 
|---|---|---|
| id* | `${string}:${string}` | |
| asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. | |
| disabled | boolean |