---
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 numeric value (percentage) for `defaultSize` in `Resizable.Item`.
```tsx
One
Two
```
### Use Min and Max Size
To set the minimum and maximum sizes, set numeric values (percentage) for `minSize` and `maxSize` in `Resizable.Item`.
```tsx
One
Two
```
### Use Keyboard Step
To set the keyboard step, set a numeric value (percentage) for `keyboardStep`.
```tsx
OneTwo
```
### Collapsible
To make an item collapsible, set `collapsible` to `true`.
Specify the minimum value before collapsing with `minSize`, and the value when collapsed with `collapsedSize`.
```tsx
{
console.log("collapsed item")
}}
onExpand={() => {
console.log("expand item")
}}
>
One
Two {
console.log("collapsed item")
}}
onExpand={() => {
console.log("expand item")
}}
>
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
If you want to handle resize events, use `onResize`. `onResize` provides the changed size and the previous size.
```tsx
{
console.log("resized", size, prevSize)
}}
>
One
Two
```
### Save Values to Local Storage
To save values to local storage, set a key for saving to local storage in `storageKey`.
:::warning
When saving values to local storage or similar, you must set an `id` on `Resizable.Item` to associate each saved value with the `Resizable.Item`.
:::
:::warning
If you dynamically mount `Resizable.Item`, you need to set a numerical value to `order` to determine the order of the items.
:::
```tsx
const [showLeft, showLeftControls] = useBoolean(true)
const [showRight, showRightControls] = useBoolean(true)
return (
One
Two
{showLeft ? (
<>
Left
>
) : null}
Middle
{showRight ? (
<>
Right
>
) : null}
)
```
### Save Values to Cookies
To save values to `cookies`, set `getItem` and `setItem` in `storage`.
:::note
This is an effective approach for sites rendered on the server side, such as with Next.js.
:::
```tsx preview functional client
const storage = useMemo(
() => ({
getItem: (key) => {
const match = document.cookie.match(new RegExp(`(^| )${key}=([^;]+)`))
return match ? match[2] : null
},
setItem: (key, value) => {
document.cookie = `${key}=${value}; max-age=31536000; path=/`
},
}),
[],
)
return (
One
Two
)
```
### 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. |
| `disabled` | - | `boolean` | If `true`, the resizable trigger will be disabled. |
| `groupProps` | - | `ResizableGroupProps` | Props for resizable component. |
| `keyboardStep` | `10` | `number` | Unit to resize by keyboard operation. |
| `onLayout` | - | `PanelGroupOnLayout` | The callback invoked when resizable items are resized. |
| `orientation` | `"horizontal"` | `"horizontal" \| "vertical"` | The orientation of the resizable. |
| `rootRef` | - | `ForwardedRef` | Ref for resizable root element. |
| `storage` | - | `PanelGroupStorage` | A callback that gets and sets a value in custom storage. |
| `storageKey` | - | `string` | Key of value saved in storage. By default, it is saved to `local storage`. |
### Resizable.Item
| Prop | Default | Type | Description |
| --------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- |
| `as` | - | `keyof HTMLElementTagNameMap` | 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. |
| `collapsedSize` | - | `number` | The collapsed size of the resizable item. |
| `collapsible` | `false` | `boolean` | If `true`, the resizable item can be collapsed. |
| `controlRef` | - | `RefObject` | Ref of the resizable item callback. |
| `defaultSize` | - | `number` | The initial size of the resizable item. |
| `maxSize` | - | `number` | The maximum allowed value of the resizable item. |
| `minSize` | - | `number` | The minimum allowed value of the resizable item. |
| `onCollapse` | - | `() => void` | The callback invoked when resizable item are collapsed. |
| `onExpand` | - | `() => void` | The callback invoked when resizable item are expanded. |
| `onResize` | - | `(size: number, prevSize: number \| undefined) => void` | The callback invoked when resizable item are resized. |
| `order` | - | `number` | Order for the resizable item. |
### Resizable.Trigger
| Prop | Default | Type | Description |
| ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- |
| `as` | - | `keyof HTMLElementTagNameMap` | 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. |
| `disabled` | `false` | `boolean` | If `true`, the resizable trigger will be disabled. |
| `icon` | - | `ReactElement` | The resizable trigger icon to use. |
| `iconProps` | - | `HTMLStyledProps` | Props for resizable trigger icon component. |
| `onDragging` | - | `(dragging: boolean) => void` | The callback invoked when resizable trigger are dragged. |
## Accessibility
Currently, this section is being updated due to the migration of v2.