---
title: Resizable
description: "`Resizable` is accessible resizable panel groups and layouts with keyboard support."
links:
- style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/resizable/resizable.style.ts
- source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/resizable
- storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-resizable--basic
---
# Resizable
`Resizable` is accessible resizable panel groups and layouts with keyboard support.
```tsx
OneTwo
```
## Usage
```tsx
import { Resizable } from "@yamada-ui/react"
```
```tsx
import { Resizable } from "@/components/ui"
```
```tsx
import { Resizable } from "@workspaces/ui"
```
```tsx
```
### Change Variants
```tsx
{(variant) => (
{toTitleCase(variant)}
Two
)}
```
### Change Color Scheme
```tsx
{(colorScheme) => (
One
Two
)}
```
### Change Orientation
To change the orientation, set `orientation` to either `"horizontal"` or `"vertical"`. By default, `"horizontal"` is set.
```tsx
{(orientation) => (
OneTwo
)}
```
### Use Default Size
To set the default size, set a string or number for `defaultSize` in `Resizable.Item`.
```tsx
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`.
```tsx
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`.
```tsx
One
Two
One
Two
```
### Add Icons
To add icons, set a `ReactNode` to the `icon` of `Resizable.Trigger`.
```tsx
One} />
Two
One
} />
Two
```
### Nested Structure
```tsx
LeftTopBottomTopLeftRight
```
### Disable
To disable, set `disabled` to `true`.
```tsx
OneTwoThree
```
```tsx
OneTwoThree
```
### Handle Resize Events
```tsx
{
console.log("layout change", layout)
}}
onLayoutChanged={(layout) => {
console.log("layout changed", layout)
}}
>
{
console.log("item resize", panelSize, id, prevPanelSize)
}}
>
One
Two
```
### Save Values to LocalStorage or Cookie
To save values to localStorage or Cookie, use `Resizable.useLayout`.
:::note
You must set an `id` to `Resizable.Item` to associate each saved value with the `Resizable.Item`.
:::
```tsx preview functional client
const storage: Resizable.Storage = useMemo(
() => ({
getItem: (key) => {
if (!createdDom()) return null
const match = document.cookie.match(new RegExp(`(^| )${key}=([^;]+)`))
return match ? (match[2] ?? null) : null
},
setItem: (key, value) => {
if (!createdDom()) return
document.cookie = `${key}=${value}; max-age=31536000; path=/`
},
}),
[],
)
const { defaultLayout, onLayoutChanged } = Resizable.useLayout({
id: "persistence",
storage,
})
return (
One
Two
)
```
To use local storage, set `localStorage` to `storage`.
```tsx
const { defaultLayout, onLayoutChanged } = Resizable.useLayout({
id: "persistence",
storage: localStorage,
})
```
### Control
```tsx
const controlRef = useRef(null)
return (
<>
One
Two
>
)
```
## Props
### Resizable.Root
| Prop | Default | Type | Description |
| ------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ |
| `as` | - | `As` | The HTML element to render. |
| `asChild` | - | `boolean` | Merges its props onto its immediate child. |
| `css` | - | `CSSObject \| CSSObject[]` | The CSS object. |
| `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. |
| `variant` | `"border"` | `"border" \| "plain" \| "spacer"` | The variant of the component. |
| `controlRef` | - | `RefObject` | Ref of the resizable item callback. |
### Resizable.Item
| Prop | Default | Type | Description |
| ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ |
| `asChild` | - | `boolean` | Merges its props onto its immediate child. |
| `css` | - | `CSSObject \| CSSObject[]` | The CSS object. |
| `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. |
| `controlRef` | - | `RefObject` | Ref of the resizable item callback. |
### Resizable.Trigger
| Prop | Default | Type | Description |
| ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------- |
| `asChild` | - | `boolean` | Merges its props onto its immediate child. |
| `css` | - | `CSSObject \| CSSObject[]` | The CSS object. |
| `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. |
| `icon` | - | `ReactElement` | The resizable trigger icon to use. |
| `iconProps` | - | `HTMLStyledProps` | Props for resizable trigger icon component. |
## Accessibility
The `Resizable` follows the [WAI-ARIA - Window Splitter Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/windowsplitter/) for accessibility.
### Keyboard Navigation
| Key | Description | State |
| -------------- | ---------------------------------------------------------------------- | -------------------------- |
| `ArrowRight` | Increases the value. | `orientation="horizontal"` |
| `ArrowLeft` | Decreases the value. | `orientation="horizontal"` |
| `ArrowUp` | Increases the value. | `orientation="vertical"` |
| `ArrowDown` | Decreases the value. | `orientation="vertical"` |
| `Enter` | If expanded, collapses the pane; if collapsed, restores it to minSize. | `collapsible="true"` |
| `Home` | Sets the value to `minSize`. | - |
| `End` | Sets the value to `maxSize`. | - |
| `F6` | Moves focus to the next separator. | - |
| `Shift` + `F6` | Moves focus to the previous separator. | - |
### ARIA Roles and Attributes
| Element | Roles and Attributes | Usage |
| --------------------------- | -------------------- | ---------------------------------------------------------------------------------------------- |
| `div.ui-resizable__item` | `id` | Used to associate with `div.ui-resizable__trigger`. |
| `div.ui-resizable__trigger` | `role="separator"` | Indicates that this is a separator. |
| | `aria-controls` | Sets the `id` of the associated `div.ui-resizable__item`. |
| | `aria-orientation` | Sets the same value as `orientation`. |
| | `aria-valuemin` | Calculated from `0` to `100` based on the `minSize` value. Default is `0`. |
| | `aria-valuemax` | Calculated from `0` to `100` based on the `maxSize` value. Default is `100`. |
| | `aria-valuenow` | Sets the current value. |
| | `aria-disabled` | Sets to `"true"` when `disabled` is enabled on either `Resizable.Root` or `Resizable.Trigger`. |
## Similar Components
- [Bleed](https://yamada-ui.com/docs/components/bleed.md): `Bleed` is a component used to extend elements beyond the boundaries of a container.
- [Box](https://yamada-ui.com/docs/components/box.md): `Box` is the most abstract component on which all other components are built. By default, it renders a `div` element.
- [Center](https://yamada-ui.com/docs/components/center.md): `Center` is a component that aligns the child elements in the center within the component.
- [Container](https://yamada-ui.com/docs/components/container.md): `Container` is a component used as a general division element. By default, it renders the `section` element.
- [Flex](https://yamada-ui.com/docs/components/flex.md): `Flex` is a component that sets `flex` to `Box`. Also, convenient style shorthand is available.
- [Float](https://yamada-ui.com/docs/components/float.md): `Float` is a component used to fix elements to the edges of a container.
- [Grid](https://yamada-ui.com/docs/components/grid.md): `Grid` is a component for managing grid layouts. It also comes with handy style shorthand.
- [Group](https://yamada-ui.com/docs/components/group.md): `Group` is a component that groups and attaches multiple elements together.
## Uses Components & Hooks
- [useValue](https://yamada-ui.com/docs/hooks/use-value.md): `useValue` is a custom hook that combines `useBreakpointValue` and `useColorModeValue`.