Resizable

Resizable is accessible resizable panel groups and layouts with keyboard support.

One
Two

Usage

import { Resizable } from "@yamada-ui/react"
<Resizable.Root>
  <Resizable.Item />
  <Resizable.Trigger />
</Resizable.Root>

Change Variants

Border
Two
Spacer
Two

Change Color Scheme

One
Two
One
Two

Change Orientation

To change the orientation, set orientation to either "horizontal" or "vertical". By default, "horizontal" is set.

One
Two
One
Two

Use Default Size

To set the default size, set a string or number for defaultSize in Resizable.Item.

One
Two

Use Min and Max Size

To set the minimum and maximum sizes, set a string or number for minSize and maxSize in Resizable.Item.

One
Two

Collapsible

To make an item collapsible, set collapsible to true.

Specify the string or number before collapsing with minSize, and the string or number when collapsed with collapsedSize.

One
Two
One
Two

Add Icons

To add icons, set a ReactNode to the icon of Resizable.Trigger.

One
Two
One
Two

Nested Structure

Left
Top
Bottom
Top
Left
Right

Disable

To disable, set disabled to true.

One
Two
Three
One
Two
Three

Handle Resize Events

One
Two

Save Values to Local Storage or Cookies

To save values to local storage or Cookies, use Resizable.useLayout.

One
Two

To use local storage, set localStorage to storage.

const { defaultLayout, onLayoutChanged } = Resizable.useLayout({
  id: "persistence",
  storage: localStorage,
})

Control

One
Two

Props

Accessibility

The Resizable follows the WAI-ARIA - Window Splitter Pattern for accessibility.

Keyboard Navigation

KeyDescriptionState
ArrowRightIncreases the value based on the keyboardStep value.orientation="horizontal"
ArrowLeftDecreases the value based on the keyboardStep value.orientation="horizontal"
ArrowUpIncreases the value based on the keyboardStep value.orientation="vertical"
ArrowDownDecreases the value based on the keyboardStep value.orientation="vertical"
EnterIf expanded, collapses the pane; if collapsed, restores it to minSize.collapsible="true"
HomeSets the value to minSize.-
EndSets the value to maxSize.-

ARIA Roles and Attributes

ComponentRoles and AttributesUsage
Resizable.ItemidUsed to associate with Resizable.Trigger.
Resizable.Triggerrole="separator"Indicates that this is a separator.
aria-controlsSets the id of the associated Resizable.Item.
aria-orientationSets "horizontal" or "vertical" based on the orientation value. Default is "horizontal".
aria-valueminSets the minSize value. Default is 0.
aria-valuemaxSets the maxSize value. Default is 100.
aria-valuenowSets the current value.