---
title: "Resizable"
description: "Panels and grids of cells that people size with a drag or the keyboard. The lines show hover, drag, and focus, with a 44px touch target."
url: https://gelatinui.com/components/resizable
markdown_url: https://gelatinui.com/components/resizable.md
access: free
install: "npx shadcn@latest add @gelatin-ui/resizable"
registry_item: https://gelatinui.com/r/resizable.json
version: "2026-11-08"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Resizable

> Panels and grids of cells that people size with a drag or the keyboard. The lines show hover, drag, and focus, with a 44px touch target.

Page: https://gelatinui.com/components/resizable

## When to use it

Best for: Panels or grid cells that the user sizes with a drag or the keyboard.

- Use it for panes that the user sizes, such as a list next to a reader.
- Give each panel a `minSize`, so no panel shrinks to 0.
- Use `ResizableGrid` when columns and rows must size together.

## When not to use it

- For a side menu of an app, use a [Sidebar](https://gelatinui.com/components/sidebar.md).
- For content that only scrolls, use a [Scroll Area](https://gelatinui.com/components/scroll-area.md).

## Notes for agents

- Number sizes are pixels; string sizes are percent or a unit.
- `collapsible` with `collapsedSize` folds a panel to a rail.
- `useDefaultLayout` saves the layout in `localStorage`.

## Anatomy

```text
ResizablePanelGroup
├─ ResizablePanel (0..n)
├─ ResizableHandle (0..n)
├─ ResizableSeparatorOverlay (0..n)
├─ ResizableGrid (0..n)
├─ ResizableCell (0..n)
└─ ResizableGridline (0..n)
```

## API reference

### ResizablePanelGroup

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  | CSS class name. |
| `id` | `string` |  | Uniquely identifies this group within an application. Falls back to `useId` when not provided. ℹ️ This value will also be assigned to the `id` and `data-testid` attributes; (an explicit `data-testid` prop will take precedence). |
| `style` | `CSSProperties` |  | CSS properties. ⚠️ The default inline styles cannot be overridden, except for `overflow`. |
| `children` | `ReactNode` |  | Panel and Separator components that comprise this group. |
| `defaultLayout` | `Layout` |  | Default layout for the Group. ℹ️ This value allows layouts to be remembered between page reloads. ⚠️ Slight layout shift may occur when server-rendering panels with percentage-based default sizes. Refer to the documentation for suggestions on how to minimize the impact of this. |
| `disableCursor` | `boolean` |  | This library sets custom mouse cursor styles to indicate drag state. Use this prop to disable that behavior for Panels and Separators in this group. |
| `disabled` | `boolean` | false | Disable resize functionality. |
| `elementRef` | `Ref<HTMLDivElement \| null>` |  | Ref attached to the root `HTMLDivElement`. |
| `groupRef` | `Ref<GroupImperativeHandle \| null>` |  | Exposes the following imperative API: - `getLayout: Layout` - `setLayout(layout: Layout): Layout` ℹ️ The `useGroupRef` and `useGroupCallbackRef` hooks are exported for convenience use in TypeScript projects. |
| `onLayoutChange` | `function` |  | Called when the Group's layout is changing. ⚠️ For layout changes caused by pointer events, this method is called each time the pointer is moved. For most cases, it is recommended to use the `onLayoutChanged` callback instead. |
| `onLayoutChanged` | `function` |  | Called after the Group's layout has been changed. ℹ️ For layout changes caused by pointer events, this method is not called until the pointer has been released. This method is recommended when saving layouts to some storage api. ℹ️ The second argument contains meta information about the layout change. The `isUserInteraction` attribute signals whether the resize was caused by direct user input. It is true for resizes caused by pointer or keyboard input and false for other triggers (e.g. imperative API calls, initial mount, etc.) The `requestedLayout` attribute is the layout before constraints were applied for the current Group size; prefer it when persisting layouts. |
| `resizePreviewMode` | `ResizePreviewMode` | "panel" | Controls whether pointer dragging updates `Panel` sizes immediately, or renders overlay separator previews until the pointer is released. Defaults to `"panel"` (immediate resizing); `"separator"` defers resizing until release. Customize previews using the `SeparatorOverlay` component. |
| `resizeTargetMinimumSize` | `{ coarse: number; fine: number; }` | HIT_TARGET | Minimum size of the resizable hit target area (either `Separator` or `Panel` edge). This threshold ensures targets are large enough to avoid mis-clicks. - Coarse inputs (typically a finger on a touchscreen) have reduced accuracy; to ensure accessibility and ease of use, hit targets should be larger to prevent mis-clicks. - Fine inputs (typically a mouse) can be smaller ℹ️ Apple interface guidelines suggest `20pt` (`27px`) on desktops and `28pt` (`37px`) for touch devices. In practice this seems to be much larger than many of their own applications use though. |
| `orientation` | `"horizontal" \| "vertical"` | "horizontal" | Specifies the resizable orientation ("horizontal" or "vertical"); defaults to "horizontal" |

### ResizablePanel

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  | CSS class name. ⚠️ Class is applied to nested `HTMLDivElement` to avoid styles that interfere with Flex layout. |
| `id` | `string` |  | Uniquely identifies this panel within the parent group. Falls back to `useId` when not provided. ℹ️ This prop is used to associate persisted group layouts with the original panel. ℹ️ This value will also be assigned to the `id` and `data-testid` attributes; (an explicit `data-testid` prop will take precedence). |
| `style` | `CSSProperties` |  | CSS properties. ⚠️ The default inline styles cannot be overridden, except for `overflow`. |
| `collapsedSize` | `string \| number` | "0%" | Panel size when collapsed; defaults to 0%. |
| `collapsedThreshold` | `string \| number` |  | Distance a collapsible panel must be resized past its `minSize` to collapse, or past its `collapsedSize` to expand. Defaults to half the distance between `collapsedSize` and `minSize`. For example if a panel declares `collapsedSize="5%"`, `collapsedThreshold="5%"`, and `minSize="25%"`, it will collapse when resized below 20% and expand when resized above 10%. ℹ️ Interpretation rules: - Numbers are interpreted as pixels (e.g. `minSize={200}` is 200 pixels) - Strings without explicit units are interpreted as percentage (e.g. `minSize="50"` is 50 percent) - Use explicit units (e.g. "px", "%", "em", "rem", "vh", or "vw") to change interpretation |
| `collapsible` | `boolean` | false | This panel can be collapsed. ℹ️ A collapsible panel will collapse when its size is less than the specified `minSize` |
| `defaultSize` | `string \| number` |  | Default size of Panel within its parent group; default is auto-assigned based on the total number of Panels. ℹ️ Interpretation rules: - Numbers are interpreted as pixels (e.g. `defaultSize={200}` is 200 pixels) - Strings without explicit units are interpreted as percentage (e.g. `defaultSize="50"` is 50 percent) - Use explicit units (e.g. "px", "%", "em", "rem", "vh", or "vw") to change interpretation ⚠️ Percentage based sizes may cause slight layout shift when server-rendering. For more information see the documentation. |
| `disabled` | `boolean` |  | When disabled, a panel cannot be resized either directly or indirectly (by resizing another panel). |
| `elementRef` | `Ref<HTMLDivElement \| null>` |  | Ref attached to the root `HTMLDivElement`. |
| `groupResizeBehavior` | `"preserve-pixel-size" \| "preserve-relative-size"` | "preserve-relative-size" | How should this Panel behave if the parent Group is resized? Defaults to `preserve-relative-size`. - `preserve-relative-size`: Retain the current relative size (as a percentage of the Group) - `preserve-pixel-size`: Retain its current size (in pixels) ℹ️ Panel min/max size constraints may impact this behavior. ⚠️ A Group must contain at least one Panel with `preserve-relative-size` resize behavior. |
| `maxSize` | `string \| number` | "100%" | Maximum size of Panel within its parent group; defaults to `"100%"`. ℹ️ Interpretation rules: - Numbers are interpreted as pixels (e.g. `maxSize={200}` is 200 pixels) - Strings without explicit units are interpreted as percentage (e.g. `maxSize="50"` is 50 percent) - Use explicit units (e.g. "px", "%", "em", "rem", "vh", or "vw") to change interpretation |
| `minSize` | `string \| number` | "0%" | Minimum size of Panel within its parent group; defaults to 0%. ℹ️ Interpretation rules: - Numbers are interpreted as pixels (e.g. `minSize={200}` is 200 pixels) - Strings without explicit units are interpreted as percentage (e.g. `minSize="50"` is 50 percent) - Use explicit units (e.g. "px", "%", "em", "rem", "vh", or "vw") to change interpretation |
| `onResize` | `function` |  | Called when panel sizes change. |
| `panelRef` | `Ref<PanelImperativeHandle \| null>` |  | Exposes the following imperative API: - `collapse: void` - `expand: void` - `getSize: PanelSize` - `isCollapsed: boolean` - `resize(size: number \| string): void` ℹ️ The `usePanelRef` and `usePanelCallbackRef` hooks are exported for convenience use in TypeScript projects. |

### ResizableHandle

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  | CSS class name. ℹ️ Use the `data-separator` attribute for custom _hover_ and _active_ styles ⚠️ The following properties cannot be overridden: `flex-grow`, `flex-shrink` |
| `id` | `string` |  | Uniquely identifies the separator within the parent group. Falls back to `useId` when not provided. ℹ️ This value will also be assigned to the `id` and `data-testid` attributes; (an explicit `data-testid` prop will take precedence). |
| `style` | `CSSProperties` |  | CSS properties. ℹ️ Use the `data-separator` attribute for custom _hover_ and _active_ styles ⚠️ The following properties cannot be overridden: `flex-grow`, `flex-shrink` |
| `disabled` | `boolean` |  | When disabled, the separator cannot be used to resize its neighboring panels. ℹ️ The panels may still be resized indirectly (while other panels are being resized). To prevent a panel from being resized at all, it needs to also be disabled. |
| `disableDoubleClick` | `boolean` |  | When true, double-clicking this `Separator` will not reset its `Panel` to its default size. |
| `elementRef` | `Ref<HTMLDivElement>` |  | Ref attached to the root `HTMLDivElement`. |
| `preview` | `ReactNode` |  | Overrides the `Group` default preview for this `Separator` when `resizePreviewMode` is "separator". |
| `withHandle` | `boolean` |  | Shows a grip pill on the line. |
| `valueText` | `function` | defaultValueText | The spoken size (`aria-valuetext`) from the `aria-valuenow` percent. Translate it. Default: "40%". An `aria-valuetext` prop wins. |

### ResizableSeparatorOverlay

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### ResizableGrid

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  | CSS class name. |
| `id` | `string` |  | Uniquely identifies this grid within an application. Falls back to `useId` when not provided. ℹ️ This value will also be assigned to the `id` and `data-testid` attributes; (an explicit `data-testid` prop will take precedence). |
| `style` | `CSSProperties` |  | CSS properties. ⚠️ Grid template and display properties are managed by the Grid and cannot be overridden. |
| `children` | `ReactNode` |  | Cell and Gridline components that comprise this grid. ⚠️ Cell and Gridline elements must be direct DOM children of their parent Grid element. |
| `columns` | `number \| GridTrackProps[]` |  | Grid columns; either the number of columns or an array of size constraints (one per column). |
| `defaultLayout` | `Partial<GridLayout>` |  | Default layout for either or both of the Grid's axes. ℹ️ This value allows layouts to be remembered between page reloads. |
| `disableCursor` | `boolean` |  | This library sets custom mouse cursor styles to indicate drag state. Use this prop to disable that behavior for this grid. |
| `disabled` | `boolean` | false | Disable resize functionality. |
| `elementRef` | `Ref<HTMLDivElement \| null>` |  | Ref attached to the root `HTMLDivElement`. |
| `gridRef` | `Ref<GridImperativeHandle \| null>` |  | Exposes the following imperative API: - `getLayout: GridLayout` - `getTrackById(axis: "column" \| "row", id: string \| number): GridTrackImperativeHandle` - `getTrackByIndex(axis: "column" \| "row", index: number): GridTrackImperativeHandle` - `setLayout(layout: Partial<GridLayout>): GridLayout` ℹ️ The `useGridRef` and `useGridCallbackRef` hooks are exported for convenience use in TypeScript projects. |
| `onLayoutChange` | `function` |  | Called when the Grid's layout is changing. ⚠️ For layout changes caused by pointer events, this method is called each time the pointer is moved. For most cases, it is recommended to use the `onLayoutChanged` callback instead. |
| `onLayoutChanged` | `function` |  | Called after the Grid's layout has been changed. ℹ️ For layout changes caused by pointer events, this method is not called until the pointer has been released. This method is recommended when saving layouts to some storage api. |
| `resizeTargetMinimumSize` | `{ coarse: number; fine: number; }` | HIT_TARGET | Minimum size of the resizable hit target area (either a `Gridline` or a `Cell` edge). This threshold ensures targets are large enough to avoid mis-clicks. ℹ️ Refer to the `Group` prop of the same name for more information. |
| `rows` | `number \| GridTrackProps[]` |  | Grid rows; either the number of rows or an array of size constraints (one per row). |

### ResizableCell

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  | CSS class name. |
| `id` | `string` |  | Uniquely identifies this cell within the parent grid. Falls back to `useId` when not provided. ℹ️ This value will also be assigned to the `id` and `data-testid` attributes; (an explicit `data-testid` prop will take precedence). |
| `style` | `CSSProperties` |  | CSS properties. ⚠️ Grid placement properties are managed by the Cell and cannot be overridden. |
| `children` | `ReactNode` |  | Cell contents. |
| `column` | `number` |  | Index of the (first) column this cell occupies. |
| `columnSpan` | `number` | 1 | Number of columns this cell spans; defaults to 1. |
| `elementRef` | `Ref<HTMLDivElement \| null>` |  | Ref attached to the root `HTMLDivElement`. |
| `row` | `number` |  | Index of the (first) row this cell occupies. |
| `rowSpan` | `number` | 1 | Number of rows this cell spans; defaults to 1. |

### ResizableGridline

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `ReactNode` |  | Gridline contents (e.g. a drag handle icon). |
| `className` | `string` |  | CSS class name. ℹ️ Use the `data-separator` attribute for custom _hover_ and _active_ styles |
| `disabled` | `boolean` |  | When disabled, the gridline cannot be used to resize its neighboring tracks. ℹ️ The tracks may still be resized indirectly (e.g. by an intersecting gridline or another boundary). To prevent a track from being resized at all, it needs to also be disabled. |
| `elementRef` | `Ref<HTMLDivElement>` |  | Ref attached to the root `HTMLDivElement`. |
| `style` | `CSSProperties` |  | CSS properties. ⚠️ Grid placement properties are managed by the gridline and cannot be overridden. |
| `type` | `"column" \| "row"` |  | Column gridlines are vertical; they resize the columns on either side of them. Row gridlines are horizontal; they resize the rows on either side of them. |
| `column` | `number` |  | When `type` is "column", the gridline is rendered along the leading (left) edge of this column (between it and the previous column); must be greater than 0 and less than the number of columns. When `type` is "row", index of the first column the gridline is rendered alongside of; defaults to 0. |
| `row` | `number` |  | When `type` is "column", index of the first row the gridline is rendered alongside of; defaults to 0. When `type` is "row", the gridline is rendered along the leading (top) edge of this row (between it and the previous row); must be greater than 0 and less than the number of rows. |
| `withHandle` | `boolean` |  | Shows a grip pill on the line. |
| `valueText` | `function` | defaultValueText | The spoken size (`aria-valuetext`) from the `aria-valuenow` percent of the track before the line. Translate it. Default: "40%". |
| `aria-label` | `string` |  | Names what the line sizes ("Resize the revenue column"). |
| `aria-labelledby` | `string` |  | The id of a heading that names what the line sizes. |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| ResizablePanelGroup | `resizable-panel-group` | `data-orientation`, `data-separator-overlay` |  |  |
| ResizablePanel | `resizable-panel` |  |  |  |
| ResizableHandle | `resizable-handle` | `data-orientation`, `data-separator-overlay` |  |  |
| ResizableSeparatorOverlay | `resizable-separator-overlay` | `data-orientation`, `data-separator-overlay` |  |  |
| ResizableGrid | `resizable-grid` |  |  |  |
| ResizableCell | `resizable-cell` |  |  |  |
| ResizableGridline | `resizable-gridline` |  |  |  |

## Usage

Put a `ResizableHandle` between two `ResizablePanel` parts in a group.

```tsx title="mail-layout.tsx"
import {
  ResizableHandle,
  ResizablePanel,
  ResizablePanelGroup,
} from "@/components/ui/resizable";

export function MailLayout() {
  return (
    <ResizablePanelGroup className="h-96 rounded-lg border">
      <ResizablePanel defaultSize="35%" minSize={200}>
        <div className="p-4">Inbox</div>
      </ResizablePanel>
      <ResizableHandle withHandle />
      <ResizablePanel minSize={240}>
        <div className="p-4">Message</div>
      </ResizablePanel>
    </ResizablePanelGroup>
  );
}
```

## Compose

Rules:

- Group with a Frame (`group-in-frames`): Put related panels in one `Frame` with its header and footer outside the panels, and keep a plain `Card` for one block of content.
- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui/resizable
```

It adds 8 registry items: 7 files, 1621 lines, and the npm packages `@base-ui/react`, `@mantine/hooks`, `@phosphor-icons/react`, `react-resizable-panels`, `tailwind-merge`, `tailwind-variants`.

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Sidebar](https://gelatinui.com/components/sidebar.md)
- [Scroll Area](https://gelatinui.com/components/scroll-area.md)
- [Separator](https://gelatinui.com/components/separator.md)

## Keyboard

| Keys | Action |
| --- | --- |
| ← → | Moves a vertical handle. Up and Down move a horizontal one. |
| Enter | Folds or opens a collapsible panel. |
| F6 | Moves between the handles. |

## Accessibility

Each handle is a `separator` with its size as a value; `valueText` can say it in words.

On touch, each handle has a 44px target.
