---
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
---
```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
>
)
```
## Uses Components & Hooks
## 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 based on the `keyboardStep` value. | `orientation="horizontal"` |
| `ArrowLeft` | Decreases the value based on the `keyboardStep` value. | `orientation="horizontal"` |
| `ArrowUp` | Increases the value based on the `keyboardStep` value. | `orientation="vertical"` |
| `ArrowDown` | Decreases the value based on the `keyboardStep` 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`. | - |
### ARIA Roles and Attributes
| Component | Roles and Attributes | Usage |
| ------------------- | -------------------- | ------------------------------------------------------------------------------------------------ |
| `Resizable.Item` | `id` | Used to associate with `Resizable.Trigger`. |
| `Resizable.Trigger` | `role="separator"` | Indicates that this is a separator. |
| | `aria-controls` | Sets the `id` of the associated `Resizable.Item`. |
| | `aria-orientation` | Sets `"horizontal"` or `"vertical"` based on the `orientation` value. Default is `"horizontal"`. |
| | `aria-valuemin` | Sets the `minSize` value. Default is `0`. |
| | `aria-valuemax` | Sets the `maxSize` value. Default is `100`. |
| | `aria-valuenow` | Sets the current value. |