Resizable
SolidJS components for building resizable panels and splitters.
import Resizable from '@corvu/resizable'
import type { VoidComponent } from 'solid-js'
const ResizableExample: VoidComponent = () => {
return (
<div class="size-full p-10 @xl:p-20">
<Resizable class="size-full">
<Resizable.Panel
initialSize={0.3}
minSize={0.2}
class="rounded-lg bg-corvu-100"
/>
<Resizable.Handle
aria-label="Resize Handle"
class="group basis-3 px-[3px]"
>
<div class="size-full rounded transition-colors corvu-group-active:bg-corvu-300 corvu-group-dragging:bg-corvu-100" />
</Resizable.Handle>
<Resizable.Panel initialSize={0.7} minSize={0.2}>
<Resizable orientation="vertical" class="size-full">
<Resizable.Panel
initialSize={0.5}
minSize={0.2}
class="rounded-lg bg-corvu-100"
/>
<Resizable.Handle
aria-label="Resize Handle"
class="group basis-3 py-[3px]"
>
<div class="size-full rounded transition-colors corvu-group-active:bg-corvu-300 corvu-group-dragging:bg-corvu-100" />
</Resizable.Handle>
<Resizable.Panel
initialSize={0.5}
minSize={0.2}
class="rounded-lg bg-corvu-100"
/>
</Resizable>
</Resizable.Panel>
</Resizable>
</div>
)
}
export default ResizableExample
import animatePlugin from 'tailwindcss-animate'
import corvuPlugin from '@corvu/tailwind'
import formsPlugin from '@tailwindcss/forms'
/** @type {import('tailwindcss').Config} */
export default {
content: ['./src/**/*.{ts,tsx}'],
theme: {
extend: {
colors: {
corvu: {
bg: '#f3f1fe',
100: '#e6e2fd',
200: '#d4cbfb',
300: '#bcacf6',
400: '#a888f1',
text: '#180f24',
},
},
},
},
plugins: [animatePlugin, corvuPlugin, formsPlugin],
}
import Resizable from '@corvu/resizable'
import type { VoidComponent } from 'solid-js'
const ResizableExample: VoidComponent = () => {
return (
<div class="wrapper">
<Resizable>
<Resizable.Panel initialSize={0.3} minSize={0.2} class="panel" />
<Resizable.Handle aria-label="Resize Handle">
<div class="inner_handle" />
</Resizable.Handle>
<Resizable.Panel initialSize={0.7} minSize={0.2}>
<Resizable orientation="vertical">
<Resizable.Panel initialSize={0.5} minSize={0.2} class="panel" />
<Resizable.Handle aria-label="Resize Handle">
<div class="inner_handle" />
</Resizable.Handle>
<Resizable.Panel initialSize={0.5} minSize={0.2} class="panel" />
</Resizable>
</Resizable.Panel>
</Resizable>
</div>
)
}
export default ResizableExample
.wrapper {
width: 100%;
height: 100%;
padding: 2.5rem;
}
@container (min-width: 36rem) {
.wrapper {
padding: 5rem;
}
}
[data-corvu-resizable-root] {
width: 100%;
height: 100%;
}
.panel {
border-radius: 0.5rem;
background-color: hsl(249, 87%, 94%);
}
[data-corvu-resizable-handle] {
flex-basis: 0.75rem;
}
[data-corvu-resizable-handle][data-orientation="horizontal"] {
padding-left: 3px;
padding-right: 3px;
}
[data-corvu-resizable-handle][data-orientation="vertical"] {
padding-top: 3px;
padding-bottom: 3px;
}
.inner_handle {
width: 100%;
height: 100%;
border-radius: 0.25rem;
transition-property: background-color;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-duration: 150ms;
}
[data-corvu-resizable-handle][data-active] .inner_handle {
border-color: hsl(253, 80%, 82%);
}
[data-corvu-resizable-handle][data-dragging] .inner_handle {
background-color: hsl(249, 87%, 94%);
}
Features Section titled Features
- Intersectable resize handles for bidirectional resizing
- Alt key resize mode
- Keyboard resizing
- Optional management of the cursor style while resizing
- Full control from userland with access to the state, resize and collapse functions
Installation Section titled Installation
npm install @corvu/resizable
The resizable is also included in the main corvu
package under corvu/resizable
.
Usage Section titled Usage
import Resizable from '@corvu/resizable' // 'corvu/resizable'
// or
// import { Root, Panel, Handle } from '@corvu/resizable'
Anatomy Section titled Anatomy
<Resizable>
<Resizable.Panel />
<Resizable.Handle />
<Resizable.Panel />
</Resizable>
Vertical orientation Section titled Vertical orientation
The resizable primitive is aligned horizontally per default. To make it vertical, set orientation
to vertical
:
<Resizable orientation="vertical">
<Resizable.Panel />
<Resizable.Handle />
<Resizable.Panel />
</Resizable>
Preventing panel overflow Section titled Preventing panel overflow
By default, the panels could overflow if the content doesn’t fit. You should prevent this by setting overflow: hidden
on <Panel />
components.
This isn’t the default behavior because panels that nest panels shouldn’t have their overflow hidden as it breaks intersecting handles.
Alt key resizing Section titled Alt key resizing
Resizing while holding down the Alt key changes the size of a panel from both sides. The implementation attempts to replicate the behavior on macOS and in VS Code:
import LogoDark from '@assets/logo_dark.svg'
import LogoLight from '@assets/logo_light.svg'
import Resizable from '@corvu/resizable'
import type { VoidComponent } from 'solid-js'
const ResizableAltKeyExample: VoidComponent = () => {
return (
<div class="size-full p-4">
<Resizable class="size-full">
<Resizable.Panel
initialSize={0.3}
minSize={0.2}
class="rounded-lg bg-corvu-100"
/>
<Resizable.Handle
aria-label="Resize Handle"
class="group basis-3 px-[3px]"
>
<div class="size-full rounded transition-colors corvu-group-active:bg-corvu-300 corvu-group-dragging:bg-corvu-100" />
</Resizable.Handle>
<Resizable.Panel
initialSize={0.4}
minSize={0.2}
class="flex flex-col items-center justify-center space-y-2 overflow-hidden rounded-lg bg-corvu-100 px-4"
>
<img
src={LogoDark.src}
alt="corvu logo dark"
class="h-16 dark:hidden"
/>
<img
src={LogoLight.src}
alt="corvu logo light"
class="hidden h-16 dark:block"
/>
</Resizable.Panel>
<Resizable.Handle
aria-label="Resize Handle"
class="group basis-3 px-[3px]"
>
<div class="size-full rounded transition-colors corvu-group-active:bg-corvu-300 corvu-group-dragging:bg-corvu-100" />
</Resizable.Handle>
<Resizable.Panel
initialSize={0.3}
minSize={0.2}
class="rounded-lg bg-corvu-100"
/>
</Resizable>
</div>
)
}
export default ResizableAltKeyExample
import animatePlugin from 'tailwindcss-animate'
import corvuPlugin from '@corvu/tailwind'
import formsPlugin from '@tailwindcss/forms'
/** @type {import('tailwindcss').Config} */
export default {
content: ['./src/**/*.{ts,tsx}'],
theme: {
extend: {
colors: {
corvu: {
bg: '#f3f1fe',
100: '#e6e2fd',
200: '#d4cbfb',
300: '#bcacf6',
400: '#a888f1',
text: '#180f24',
},
},
},
},
plugins: [animatePlugin, corvuPlugin, formsPlugin],
}
You can also disable this behavior by setting altKey={false}
on the <Handle />
component. Or you can make this the default and only way to resize on a Handle by setting altKey="only"
.
Nested resizables Section titled Nested resizables
You can nest resizables to create more complex layouts. Resize handles automatically detect intersecting handles and allow resizing in both directions at once. You can disable these intersections if you’d like to. Check out the Handle API for more information.
import Resizable from '@corvu/resizable'
import type { VoidComponent } from 'solid-js'
const ResizableNestedExample: VoidComponent = () => {
return (
<div class="size-full p-4">
<Resizable class="size-full">
<Resizable.Panel
initialSize={0.3}
minSize={0.2}
class="rounded-lg bg-corvu-100"
/>
<Resizable.Handle
aria-label="Resize Handle"
class="group basis-3 px-[3px]"
>
<div class="size-full rounded transition-colors corvu-group-active:bg-corvu-300 corvu-group-dragging:bg-corvu-100" />
</Resizable.Handle>
<Resizable.Panel initialSize={0.4} minSize={0.2}>
<Resizable orientation="vertical" class="size-full">
<Resizable.Panel
initialSize={0.5}
minSize={0.2}
class="rounded-lg bg-corvu-100"
/>
<Resizable.Handle
aria-label="Resize Handle"
class="group basis-3 py-[3px]"
>
<div class="size-full rounded transition-colors corvu-group-active:bg-corvu-300 corvu-group-dragging:bg-corvu-100" />
</Resizable.Handle>
<Resizable.Panel initialSize={0.5} minSize={0.2}>
<Resizable class="size-full">
<Resizable.Panel
initialSize={0.5}
minSize={0.3}
class="rounded-lg bg-corvu-100"
/>
<Resizable.Handle
aria-label="Resize Handle"
class="group basis-3 px-[3px]"
>
<div class="size-full rounded transition-colors corvu-group-active:bg-corvu-300 corvu-group-dragging:bg-corvu-100" />
</Resizable.Handle>
<Resizable.Panel
aria-label="Resize Handle"
initialSize={0.5}
minSize={0.2}
class="rounded-lg bg-corvu-100"
/>
</Resizable>
</Resizable.Panel>
</Resizable>
</Resizable.Panel>
<Resizable.Handle
aria-label="Resize Handle"
class="group basis-3 px-[3px]"
>
<div class="size-full rounded transition-colors corvu-group-active:bg-corvu-300 corvu-group-dragging:bg-corvu-100" />
</Resizable.Handle>
<Resizable.Panel
initialSize={0.3}
minSize={0.2}
class="rounded-lg bg-corvu-100"
/>
</Resizable>
</div>
)
}
export default ResizableNestedExample
import animatePlugin from 'tailwindcss-animate'
import corvuPlugin from '@corvu/tailwind'
import formsPlugin from '@tailwindcss/forms'
/** @type {import('tailwindcss').Config} */
export default {
content: ['./src/**/*.{ts,tsx}'],
theme: {
extend: {
colors: {
corvu: {
bg: '#f3f1fe',
100: '#e6e2fd',
200: '#d4cbfb',
300: '#bcacf6',
400: '#a888f1',
text: '#180f24',
},
},
},
},
plugins: [animatePlugin, corvuPlugin, formsPlugin],
}
Persistent layout Section titled Persistent layout
corvu itself doesn’t provide a first party way to persist the layout of resizable panels. However, you can achieve this easily with something like the makePersisted
utility from Solid Primitives:
import { createSignal } from 'solid-js'
import { makePersisted } from '@solid-primitives/storage'
import Resizable from '@corvu/resizable'
const PersistentResizable = () => {
const [sizes, setSizes] = makePersisted(createSignal<number[]>([]), {
name: 'resizable-sizes'
})
return (
<Resizable sizes={sizes()} onSizesChange={setSizes}>
<Resizable.Panel />
<Resizable.Handle />
<Resizable.Panel />
</Resizable>
)
}
Edit the layout below and refresh the page to see how the panel sizes persist.
import { createSignal, type VoidComponent } from 'solid-js'
import { makePersisted } from '@solid-primitives/storage'
import Resizable from '@corvu/resizable'
const ResizablePersistentExample: VoidComponent = () => {
const [sizes, setSizes] = makePersisted(createSignal([]), {
name: 'resizable-sizes',
})
return (
<div class="size-full p-4">
<Resizable sizes={sizes()} onSizesChange={setSizes} class="size-full">
<Resizable.Panel
initialSize={0.3}
minSize={0.2}
class="flex items-center justify-center overflow-hidden rounded-lg bg-corvu-100"
>
{(props) => (
<p class="text-center text-sm">
Persistent size:
<br />
<span class="font-bold">{props.size}</span>
</p>
)}
</Resizable.Panel>
<Resizable.Handle
aria-label="Resize Handle"
class="group basis-3 px-[3px]"
>
<div class="size-full rounded transition-colors corvu-group-active:bg-corvu-300 corvu-group-dragging:bg-corvu-100" />
</Resizable.Handle>
<Resizable.Panel
initialSize={0.4}
minSize={0.2}
class="flex items-center justify-center overflow-hidden rounded-lg bg-corvu-100"
>
{(props) => (
<p class="text-center text-sm">
Persistent size:
<br />
<span class="font-bold">{props.size}</span>
</p>
)}
</Resizable.Panel>
<Resizable.Handle
aria-label="Resize Handle"
class="group basis-3 px-[3px]"
>
<div class="size-full rounded transition-colors corvu-group-active:bg-corvu-300 corvu-group-dragging:bg-corvu-100" />
</Resizable.Handle>
<Resizable.Panel
initialSize={0.3}
minSize={0.2}
class="flex items-center justify-center overflow-hidden rounded-lg bg-corvu-100"
>
{(props) => (
<p class="text-center text-sm">
Persistent size:
<br />
<span class="font-bold">{props.size}</span>
</p>
)}
</Resizable.Panel>
</Resizable>
</div>
)
}
export default ResizablePersistentExample
import animatePlugin from 'tailwindcss-animate'
import corvuPlugin from '@corvu/tailwind'
import formsPlugin from '@tailwindcss/forms'
/** @type {import('tailwindcss').Config} */
export default {
content: ['./src/**/*.{ts,tsx}'],
theme: {
extend: {
colors: {
corvu: {
bg: '#f3f1fe',
100: '#e6e2fd',
200: '#d4cbfb',
300: '#bcacf6',
400: '#a888f1',
text: '#180f24',
},
},
},
},
plugins: [animatePlugin, corvuPlugin, formsPlugin],
}
Collapsible panel Section titled Collapsible panel
A Panel can be configured to be collapsible by setting the collapsible
prop to true. Per default, this will collapse the panel to a size of 0, but you can define the collapsible size with the collapsedSize
property. It’s important that you configure a minSize
or it’ll never collapse as it can shrink to 0 normally.
Additionally, there is the collapseThreshold
property that you can use to define how much the user has to “overdrag” before the panel collapses. Default is 0.05
.
Here, the left Panel is collapsible with minSize={0.3}
and collapsedSize={0.15}
:
Size:
0.40
Collapsed:
no
import Resizable from '@corvu/resizable'
import type { VoidComponent } from 'solid-js'
const ResizableCollapsibleExample: VoidComponent = () => {
return (
<div class="size-full p-4">
<Resizable class="size-full">
<Resizable.Panel
initialSize={0.4}
minSize={0.3}
collapsible
collapsedSize={0.15}
class="flex items-center justify-center overflow-hidden rounded-lg bg-corvu-100"
>
{(props) => (
<p class="text-center text-sm">
Size:
<br />
<span class="font-bold">{props.size.toFixed(2)}</span>
<br />
Collapsed:
<br />
<span class="font-bold">{props.collapsed ? 'yes' : 'no'}</span>
</p>
)}
</Resizable.Panel>
<Resizable.Handle
aria-label="Resize Handle"
class="group basis-3 px-[3px]"
>
<div class="size-full rounded transition-colors corvu-group-active:bg-corvu-300 corvu-group-dragging:bg-corvu-100" />
</Resizable.Handle>
<Resizable.Panel
initialSize={0.6}
minSize={0.3}
class="rounded-lg bg-corvu-100"
/>
</Resizable>
</div>
)
}
export default ResizableCollapsibleExample
import animatePlugin from 'tailwindcss-animate'
import corvuPlugin from '@corvu/tailwind'
import formsPlugin from '@tailwindcss/forms'
/** @type {import('tailwindcss').Config} */
export default {
content: ['./src/**/*.{ts,tsx}'],
theme: {
extend: {
colors: {
corvu: {
bg: '#f3f1fe',
100: '#e6e2fd',
200: '#d4cbfb',
300: '#bcacf6',
400: '#a888f1',
text: '#180f24',
},
},
},
},
plugins: [animatePlugin, corvuPlugin, formsPlugin],
}
Userland Section titled Userland
The resizable primitive provides many ways to interact and get information about its state from userland. There are resize()
, collapse()
and expand()
functions on both the <Root />
and <Panel />
components that allow you to alter panel state from userland. Please have a look at the API documentation below!
Hoisting the context Section titled Hoisting the context
A common use case is to have expand or collapse buttons outside of your resizable layout, in a toolbar for example. There are two common and easy ways to get access to the context outside of <Resizable />
:
One approach is to use the as
prop to provide a custom component where you can access the context:
const ResizableWrapper = (props: object) => {
const context = Resizable.useContext()
// Access to the context outside of <Resizable />
return <div {...props} />
}
const Component = () => {
return (
<Resizable as={ResizableWrapper}>
<Resizable.Panel />
<Resizable.Handle />
<Resizable.Panel />
</Resizable>
)
}
Here is an example that uses this approach:
Sidepanel
import { Show, type VoidComponent } from 'solid-js'
import {
SidebarSimpleBold,
SidebarSimpleFill,
} from '@examples/primitives/resizable/icons'
import clsx from 'clsx'
import Resizable from '@corvu/resizable'
const ResizableWrapper = (props: object) => {
const context = Resizable.useContext()
const isCollapsed = () => context.sizes()[0] === 0
return (
<>
<button
onClick={() =>
isCollapsed() ? context.expand(0) : context.collapse(0)
}
class="rounded-lg bg-corvu-100 p-1 transition-all duration-100 hover:bg-corvu-200 active:translate-y-0.5"
>
<Show
when={isCollapsed()}
fallback={
<>
<SidebarSimpleBold size="20" />
<span class="sr-only">Collapse</span>
</>
}
>
<>
<SidebarSimpleFill size="20" />
<span class="sr-only">Expand</span>
</>
</Show>
</button>
<div class="mt-2 h-[calc(100%-36px)]" {...props} />
</>
)
}
const ResizableHoistingExample: VoidComponent = () => {
return (
<div class="size-full p-4">
<Resizable as={ResizableWrapper}>
{(props) => (
<>
<Resizable.Panel
initialSize={0.3}
minSize={0.2}
collapsible
class="flex justify-center overflow-hidden rounded-lg bg-corvu-200"
>
<p class="mt-2 font-bold">Sidepanel</p>
</Resizable.Panel>
<Resizable.Handle
aria-label="Resize Handle"
class={clsx('group basis-3 px-[3px]', {
hidden: props.sizes[0] === 0,
})}
>
<div class="size-full rounded transition-colors corvu-group-active:bg-corvu-300 corvu-group-dragging:bg-corvu-100" />
</Resizable.Handle>
<Resizable.Panel
initialSize={0.7}
minSize={0.5}
class="rounded-lg bg-corvu-100"
/>
</>
)}
</Resizable>
</div>
)
}
export default ResizableHoistingExample
import animatePlugin from 'tailwindcss-animate'
import corvuPlugin from '@corvu/tailwind'
import formsPlugin from '@tailwindcss/forms'
/** @type {import('tailwindcss').Config} */
export default {
content: ['./src/**/*.{ts,tsx}'],
theme: {
extend: {
colors: {
corvu: {
bg: '#f3f1fe',
100: '#e6e2fd',
200: '#d4cbfb',
300: '#bcacf6',
400: '#a888f1',
text: '#180f24',
},
},
},
},
plugins: [animatePlugin, corvuPlugin, formsPlugin],
}
The other approach is to use a signal to hoist the context:
const Component = () => {
const [resizableContext, setResizableContext] =
createSignal<ContextValue | null>(null)
// Access to the context outside of <Resizable />
return (
<Resizable>
{() => {
const context = Resizable.useContext()
setResizableContext(context)
return (
<>
<Resizable.Panel />
<Resizable.Handle />
<Resizable.Panel />
</>
)
}}
</Resizable>
)
}
Persistent layout with SSR Section titled Persistent layout with SSR
To avoid content shift when using server side rendering, we have to define the initialSize
property on every <Panel />
component. This makes sure that the panel renders with the correct size on the server. We can use the makePersisted
utility with the cookieStorage
from Solid Primitives:
import { createSignal } from 'solid-js'
import { cookieStorage, makePersisted } from '@solid-primitives/storage'
import Resizable from '@corvu/resizable'
const SSRPersistentResizable = () => {
const [sizes, setSizes] = makePersisted(createSignal<number[]>([]), {
storage: cookieStorage,
name: 'resizable-sizes'
})
return (
<Resizable sizes={sizes()} onSizesChange={setSizes}>
<Resizable.Panel initialSize={sizes()[0] ?? 0.5} />
<Resizable.Handle />
<Resizable.Panel initialSize={sizes()[1] ?? 0.5} />
</Resizable>
)
}
Accessibility Section titled Accessibility
Adheres to the Window Splitter WAI-ARIA design pattern.
Ensuring handles are accessible Section titled Ensuring handles are accessible
<Handle />
components already include required and supported aria attributes for the separator
role. Additionally, you should define a label that describes their purpose. This can be done by setting the aria-label
attribute:
<Resizable.Handle aria-label="Resize panels" />
Keyboard navigation Section titled Keyboard navigation
Handles can be resized with the keyboard. Here is a list of all implemented keyboard shortcuts:
Pressing shift while resizing with arrow keys will expand/contract the panel fully.
Key | Behavior |
---|---|
Home | Collapse preceding panels fully. |
End | Expand preceding panels fully. |
Enter | Collapse/Expand the preceding panel (Panel has to be collapsible). |
ArrowLeft | [Horizontal] Resize to the left. |
ArrowRight | [Horizontal] Resize to the right. |
ArrowUp | [Vertical] Resize to the top. |
ArrowDown | [Vertical] Resize to the bottom. |
API reference Section titled API reference
Wrapper for the resizable.
Props
Property | Default | Type/Description |
---|---|---|
orientation | 'horizontal' | 'horizontal' | 'vertical' The orientation of the resizable. |
sizes | - | number[] Panel sizes in percentage. |
onSizesChange | - | (sizes: number[]) => void Callback fired when the panel sizes change. |
initialSizes | - | Size[] Initial panel sizes. Gets overridden by the initialSize prop on components. |
keyboardDelta | 0.1 | Size The delta to use when resizing with arrow keys. |
handleCursorStyle | true | boolean Whether to handle the cursor style when resizing. |
as | div | ValidComponent Component to render the dynamic component as. |
contextId | - | string The id of the resizable context to use. |
Data attributes
Data attributes present on <Root />
components.
Property | Description |
---|---|
data-corvu-resizable-root | Present on every resizable root element. |
data-orientation | The orientation of the resizable. |
Resizable panel.
Props
Property | Default | Type/Description |
---|---|---|
initialSize | - | Size The initial size of the panel. If the panel is rendered on the server, this should be a percentage to avoid layout shifts. |
minSize | 0 | Size The minimum size of the panel. |
maxSize | 1 | Size The maximum size of the panel. |
collapsible | false | boolean Whether the panel is collapsible. |
collapsedSize | 0 | Size The size the panel should collapse to. |
collapseThreshold | 0.05 | Size How much the user has to "overdrag" for the panel to collapse. |
onResize | - | (size: number) => void Callback fired when the panel is resized. |
onCollapse | - | (size: number) => void Callback fired when the panel is collapsed. |
onExpand | - | (size: number) => void Callback fired when the panel is expanded. |
as | div | ValidComponent Component to render the dynamic component as. |
contextId | - | string The id of the resizable context to use. |
panelId | createUniqueId() | string The id attribute of the resizable panel element. |
Data attributes
Data attributes present on <Panel />
components.
Property | Description |
---|---|
data-corvu-resizable-panel | Present on every resizable panel. |
data-orientation | The orientation of the resizable. |
data-collapsed | Present if the panel is currently collapsed. |
data-expanded | Present if the panel is currently expanded. Only present on panels that are collapsible. |
Resizable handle.
Props
Property | Default | Type/Description |
---|---|---|
startIntersection | true | boolean Whether the handle is allowed to intersect with another handle at its start (Left/Top of the handle) |
endIntersection | true | boolean Whether the handle is allowed to intersect with another handle at its end (Right/Bottom of the handle) |
altKey | true | boolean | 'only' Whether Alt key resize mode is enabled. Set to 'only' to make it the default and only way to resize. |
onHandleDragStart | - | (event: PointerEvent) => void Callback fired when the handle starts being dragged. Can be prevented by calling event.preventDefault . |
onHandleDrag | - | (event: CustomEvent) => void Callback fired when the handle is being dragged. Can be prevented by calling event.preventDefault . |
onHandleDragEnd | - | (event: PointerEvent | TouchEvent | MouseEvent) => void Callback fired when the handle stops being dragged. |
as | button | ValidComponent Component to render the dynamic component as. |
contextId | - | string The id of the resizable context to use. |
Data attributes
Data attributes present on <Handle />
components.
Property | Description |
---|---|
data-corvu-resizable-handle | Present on every resizable handle. |
data-active | Present when the handle is active. |
data-dragging | Present when the handle is being dragged. |
data-orientation | The orientation of the resizable. |
Context which exposes various properties to interact with the resizable. Optionally provide a contextId to access a keyed context.
Returns
Property | Type/Description |
---|---|
orientation | Accessor<'horizontal' | 'vertical'> The orientation of the resizable. |
sizes | Accessor<number[]> The sizes of the panels. |
setSizes | Setter<number[]> Change the sizes of the panels. |
keyboardDelta | Accessor<Size> The delta to use when resizing with arrow keys. |
handleCursorStyle | Accessor<boolean> Whether to handle the cursor style when resizing. |
resize | (panelIndex: number, size: Size, strategy: ResizeStrategy) => void Resize a panel to a specific size with the given strategy. |
collapse | (panelIndex: number, strategy: ResizeStrategy) => void Collapse a panel with the given strategy. Only works if collapsible is set to true . |
expand | (panelIndex: number, strategy: ResizeStrategy) => void Expand a panel with the given strategy. Only works if collapsible is set to true . |
Context which exposes various properties to interact with a resizable panel. Optionally provide a contextId to access a keyed context.
Returns
Property | Type/Description |
---|---|
size | Accessor<number> The current size of the panel. |
minSize | Accessor<Size | null> The minimum size of the panel. |
maxSize | Accessor<Size | null> The maximum size of the panel. |
collapsible | Accessor<boolean> Whether the panel is collapsible. |
collapsedSize | Accessor<Size> The size the panel should collapse to. |
collapseThreshold | Accessor<Size> How much the user has to "overdrag" for the panel to collapse. |
collapsed | Accessor<boolean> Whether the panel is currently collapsed. |
resize | (size: Size, strategy: ResizeStrategy) => void Resize the panel to a specific size with the given strategy. |
collapse | (strategy: ResizeStrategy) => void Collapse the panel with the given strategy. Only works if collapsible is set to true . |
expand | (strategy: ResizeStrategy) => void Expand the panel with the given strategy. Only works if collapsible is set to true . |
panelId | Accessor<string> The id attribute of the resizable panel element. |
Props
Property | Type/Description |
---|---|
orientation | 'vertical' | 'horizontal' The orientation of the resizable. |
sizes | number[] The sizes of the panels. |
setSizes | Setter<number[]> Change the sizes of the panels. |
keyboardDelta | Size The delta to use when resizing with arrow keys. |
handleCursorStyle | boolean Whether to handle the cursor style when resizing. |
resize | (panelIndex: number, size: Size, strategy: ResizeStrategy) => void Resize a panel to a specific size with the given strategy. |
collapse | (panelIndex: number, strategy: ResizeStrategy) => void Collapse a panel with the given strategy. Only works if collapsible is set to true . |
expand | (panelIndex: number, strategy: ResizeStrategy) => void Expand a panel with the given strategy. Only works if collapsible is set to true . |
Props
Property | Type/Description |
---|---|
size | number The current size of the panel. |
minSize | Size The minimum size of the panel. |
maxSize | Size The maximum size of the panel. |
collapsible | boolean Whether the panel is collapsible. |
collapsedSize | Size The size the panel should collapse to. |
collapseThreshold | Size How much the user has to "overdrag" for the panel to collapse. |
collapsed | boolean Whether the panel is currently collapsed. |
resize | (size: Size, strategy: ResizeStrategy) => void Resize the panel to a specific size with the given strategy. |
collapse | (strategy: ResizeStrategy) => void Collapse the panel with the given strategy. Only works if collapsible is set to true . |
expand | (strategy: ResizeStrategy) => void Expand the panel with the given strategy. Only works if collapsible is set to true . |
panelId | string The id attribute of the resizable panel element. |
type Size = `${number}px` | number
Developed and designed by Jasmin