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

To save values to localStorage or Cookie, 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.orientation="horizontal"
ArrowLeftDecreases the value.orientation="horizontal"
ArrowUpIncreases the value.orientation="vertical"
ArrowDownDecreases the 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.-
F6Moves focus to the next separator.-
Shift + F6Moves focus to the previous separator.-

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 the separator direction. If orientation is "horizontal", it is set to "vertical", and vice versa.
aria-valueminCalculated from 0 to 100 based on the minSize value. Default is 0.
aria-valuemaxCalculated from 0 to 100 based on the maxSize value. Default is 100.
aria-valuenowSets the current value.
aria-disabledSets to true when disabled.

Similar Components

Bleed

Bleed is a component used to extend elements beyond the boundaries of a container.

Box

Box is the most abstract component on which all other components are built. By default, it renders a div element.

Center

Center is a component that aligns the child elements in the center within the component.

Container

Container is a component used as a general division element. By default, it renders the section element.

Flex

Flex is a component that sets flex to Box. Also, convenient style shorthand is available.

Float

Float is a component used to fix elements to the edges of a container.

Grid

Grid is a component for managing grid layouts. It also comes with handy style shorthand.

Group

Group is a component that groups and attaches multiple elements together.

Uses Components & Hooks