Resizable
VResizable divides a space between two or more VResizablePanels and places a handle between each pair. A handle is dragged with the pointer, or focused and moved with the arrow keys.
Usage
Examples
Vertical
orientation="vertical" stacks the panels. The group then needs a height. grip draws a grip on every handle.
Limits
minSize and maxSize take a number in percent or a CSS length such as 10rem. When a panel reaches its minimum, the handle takes the rest from the next panel along.
Collapsible panels
A collapsible panel collapses when dragged past the middle of its minimum, or with Enter on its handle, and reopens at the size it had. v-model:collapsed follows it. collapsedSize keeps a strip such as an icon rail; at 0, the content is removed from the layout and the tab order.
Drag the line to the edge, or press Enter on it.
Nested groups
A panel can hold a group of its own. Give the inner group height: 100%.
Saving the sizes
The v-model holds the sizes in percent and changes during a drag. change fires once they settle, which is the moment to save them. For a server-rendered page, a cookie lets the server render the saved sizes at once.
Sizes: 40 / 60
API
Props
| Prop | Type | Default |
|---|---|---|
orientation | ResizableOrientation'horizontal' | 'vertical' | 'horizontal' |
| Panels side by side, following the text direction, or stacked. | ||
disabled | boolean | false |
| Fixes the sizes. The handles can neither be dragged nor focused. | ||
grip | boolean | false |
| Draws a grip in the middle of every handle. | ||
step | number | 5 |
| How far an arrow key moves a handle, in percent. | ||
v-model | number[] | none |
Size of each panel in percent of the shared space, adding up to 100. Unbound, panels start from their defaultSize. | ||
| Prop | Type | Default |
|---|---|---|
index | number | 0 |
| Panel index assigned by the group. Do not set manually. | ||
defaultSize | number | none |
| Starting size in percent when the v-model gives none. Panels without one share the rest. | ||
minSize | ResizableLength | 0 |
| Smallest size: a number in percent or a CSS length. | ||
maxSize | ResizableLength | none |
| Largest size: a number in percent or a CSS length. | ||
collapsible | boolean | false |
| Lets the panel collapse by dragging or with Enter on its handle. | ||
collapsedSize | ResizableLength | 0 |
| Size of the collapsed panel, in percent or as a CSS length. At 0, the content is hidden. | ||
label | string | none |
| Accessible name of the handle that resizes the panel. | ||
v-model:collapsed | boolean | false |
| Collapsed state. Changing it collapses or reopens the panel. | ||
Events
| Event | Type |
|---|---|
change | [sizes: number[]] |
| Emits the sizes once they settle: after a drag, a key or a collapse. | |
Slots
| Slot | Type |
|---|---|
default | {} |
The VResizablePanels, two or more. | |
| Slot | Type |
|---|---|
default | {} |
| Panel content. | |
Types
Types used in the API tables. Import exported types from vectis-ui.
export type ResizableLength = number | string
CSS variables
| Token | Value |
|---|---|
--vectis-control-size-resizable-hit | 0.75rem |
--vectis-control-size-resizable-grip-length | 1.5rem |
--vectis-control-size-resizable-grip-thickness | 0.5rem |