---
title: "Workspace"
description: "Panes of tabs that people arrange: drag a tab to another pane or to an edge to split it, resize panes, maximize one, and save the layout."
url: https://gelatinui.com/components/workspace
markdown_url: https://gelatinui.com/components/workspace.md
access: pro
install: "npx shadcn@latest add @gelatin-ui-pro/workspace"
version: "2026-11-10"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Workspace

> Panes of tabs that people arrange: drag a tab to another pane or to an edge to split it, resize panes, maximize one, and save the layout.

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

## When to use it

Best for: Tools where people arrange several views at once and keep the layout they made.

- Give the Workspace a size (a parent with a height), a `defaultModel`, and `renderTabContent`.
- Keep `renderTabContent` stable (a module function or `useCallback`): a new function renders every tab again.
- Save the layout from `onModelChanged`, and change it from code with `workspaceRef` (`addTab`, `selectTab`, `closeTab`).
- Put a `WorkspaceMaximizeButton` in `renderTabsetToolbar` so a tabset can fill the Workspace.
- Set `disableClose` on a tab that must stay, such as a file list.

## When not to use it

- For a fixed set of panes that only resize, use [Resizable](https://gelatinui.com/components/resizable.md).
- For a few views in one place with no drag, use [Tabs](https://gelatinui.com/components/tabs.md).

## Notes for agents

- It wraps the react-resizable-panels 4.16 `Workspace`, which is uncontrolled: `defaultModel` is read once. Give it a `key` to load a new model.
- The tabs come from `WorkspaceTab` with a `WorkspaceTabClose` by default; pass `renderTab` to change them.
- A tabset with no tabs leaves the layout, unless it has `keepWhenEmpty`; then it shows `WorkspaceEmpty`.
- `disabled` stops drag, drop, close, and resize; select and maximize still work. `disableDrop` refuses some drops.
- In right to left text the layout and the tab strip stay left to right; the tab text, toolbar, and content read right to left.
- When the focused tab closes with its tabset, the focus goes to the selected tab of the active tabset.

## Anatomy

```text
Workspace
├─ WorkspaceTab (0..n)
├─ WorkspaceTabClose (0..n)
├─ WorkspaceToolbarButton (0..n)
├─ WorkspaceMaximizeButton (0..n)
├─ WorkspaceEmpty (0..n)
├─ WorkspaceEmptyHeader (0..n)
├─ WorkspaceEmptyTitle (0..n)
└─ WorkspaceEmptyDescription (0..n)
```

## API reference

### Workspace

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  | CSS class name. |
| `id` | `string` |  | Uniquely identifies this workspace 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. |
| `classNames` | `WorkspaceClassNames` |  | CSS class names for the elements the workspace renders within its root element: - `tabset`: root element of a tabset (`data-tabset`) - `header`: contains a tabset's tab list and toolbar (`data-tabset-header`) - `tabList`: contains a tabset's tabs (`data-tab-list`) - `tab`: passed to `renderTab` with the rest of a tab's props (`data-tab`) - `toolbar`: contains the content returned by `renderTabsetToolbar` (`data-tabset-toolbar`) - `tabPanels`: contains a tabset's tab content (`data-tab-panels`) - `tabContent`: the element each tab's content is rendered into (`data-tab-content`) - `dropIndicator`: shows where a dragged tab will be dropped within a tabset's panels (`data-drop-indicator`) - `dragPreview`: follows the pointer while a tab is dragged (`data-drag-preview`) ℹ️ Elements expose their state as data attributes (e.g. `data-tab-selected`), which can be used for styling. Elements within a tabset also have a `data-tab-placement` attribute (see `tabPlacement`). ℹ️ Like the render props, this object is part of what tabsets re-render for; in large workspaces, define it outside of the component (or memoize it) rather than inline. |
| `defaultModel` | `WorkspaceModelInput<TabData, TabsetData>` |  | Initial layout of the workspace. ℹ️ Splits and tabsets may omit their ids; they're assigned ids based on their position (see `WorkspaceModelInput`). ℹ️ This value is only used when the Workspace mounts; use the imperative `setModel` method to replace it later. |
| `disabled` | `boolean` |  | Locks the arrangement: tabs cannot be resized, dragged, dropped, or closed by the user. Selecting tabs and maximizing tabsets still work. ℹ️ This prop overrides the `disableClose` and `disableDrag` flags of individual tabs. |
| `disableDrop` | `boolean \| function` |  | Prevents tabs from being dropped onto some (or all) targets. Functions are called when the target under the pointer changes; returning `true` rejects the target. |
| `elementRef` | `Ref<HTMLDivElement \| null>` |  | Ref attached to the root `HTMLDivElement`. |
| `hiddenTabBehavior` | `function \| HiddenTabBehavior` | "keep-mounted" | What happens to the content of tabs that are not selected. Can be a function to choose per tab (e.g. based on its data). - `"keep-mounted"`: content stays mounted (and its effects keep running) - `"activity"`: content stays mounted but is rendered within a hidden React `<Activity>` boundary, so its effects are unmounted; requires React 19.2 (falls back to `"keep-mounted"` otherwise) - `"unmount"`: content is unmounted ℹ️ Moving a tab never remounts its content. ⚠️ Its React state is preserved, but its elements are moved within the document, which resets some browser state: iframes are reloaded, playing media is paused, and focused elements are blurred. |
| `onModelChanged` | `function` |  | Called after the model has changed (e.g. a tab was moved, selected, or closed, or a tabset was resized). ℹ️ For changes caused by pointer events, this method is not called until the pointer has been released. This method is recommended when saving models to some storage api. |
| `renderDragPreview` | `function` |  | Content of the element that follows the pointer while a tab is being dragged. Defaults to the tab's title (or id). |
| `renderEmptyTabset` | `function` |  | Content shown in the panels of a tabset that has no tabs (e.g. "Drag a tab here"): the root tabset of an empty workspace, or a tabset with the `keepWhenEmpty` flag. |
| `renderSeparator` | `function` |  | Separator rendered between the children of a split. Should return a `Separator` (or `null` for no separator); defaults to an unstyled `Separator`. ℹ️ Without separators, tabsets can still be resized by dragging their edges (like Panels in a Group without separators), but separators are recommended: they can be resized with the keyboard, and an edge's hit area can overlap the tabs beside it (pressing there resizes the tabset rather than dragging the tab). |
| `renderTab` | `function` |  | Renders a tab (within its tabset's tab list). Spread `props` onto the returned element: they make it a tab (its role and ARIA attributes, keyboard and pointer handling, and data attributes), and attach a `ref` that dragging and keyboard focus depend on. `renderTab={(tab, props) => ( <div {...props}> {tab.title} <TabCloseButton /> </div> )}` Individual props can be overridden or wrapped, e.g. to confirm before the Delete key closes a tab (call `props.onKeyDown` for other keys). ⚠️ Merge `className` and `style` rather than replacing them (e.g. `style={{...props.style, padding: 4 }}`): they include the `tab` entries of the `classNames` and `styles` props, and `style` includes the `touch-action` that touch dragging depends on. ℹ️ Pointer and keyboard events from interactive descendants (`button` elements, `role="button"`, or elements with a `data-tab-ignore` attribute) are ignored, so clicking a button within a tab doesn't select or drag it. ℹ️ When this prop is not provided, tabs show their title (or id) followed by a `TabCloseButton`. |
| `renderTabsetToolbar` | `function` |  | Content shown after a tabset's tab list (e.g. buttons to add a tab or maximize the tabset). ℹ️ The `useParentTabset` and `useParentTabsetState` hooks can be used within this content. |
| `resizePreviewMode` | `ResizePreviewMode` | "panel" | Controls whether pointer dragging updates sizes immediately, or renders overlay separator previews until the pointer is released. |
| `serverRenderTabContent` | `boolean \| function` | false | Render the content of selected tabs on the server. Can be a function to choose per tab (e.g. based on its data). Tab content is rendered through portals (so that moving a tab doesn't remount it), which React can't render on the server. Content opted into server rendering is rendered inline instead, then moved into a portal once hydration has finished. ⚠️ That move remounts the content once (e.g. resetting its state and re-running its effects), so this is best suited to content that is cheap to mount and benefits from being in the server-rendered HTML. ℹ️ This prop has no effect for workspaces that are not server rendered. |
| `styles` | `WorkspaceStyles` |  | CSS properties for the elements the workspace renders within its root element (see `classNames`). |
| `tabPlacement` | `"bottom" \| "left" \| "right" \| "top"` | "top" | Where tabs are placed relative to tab content. Tabs placed on the left or right are stacked ("vertical"): this determines how a dropped tab's position is found and which arrow keys move focus between tabs. ℹ️ Elements within a tabset have a `data-tab-placement` attribute, which can be used for styling (e.g. rotating tabs on the left or right). ℹ️ Tabsets can override this with the `tabPlacement` field of their model node. |
| `tabsetMinHeight` | `string` |  | Minimum height of each tabset's content area (not including its header). ℹ️ Tabsets can override this with the `minHeight` field of their model node. ℹ️ Interpretation rules: - Strings must specify a unit: "px", "em", "rem", "vh", or "vw" (e.g. `tabsetMinHeight: "200px"`) - Percentages (and strings without units) are not allowed |
| `tabsetMinWidth` | `string` |  | Minimum width of each tabset's content area (not including its header). ℹ️ Tabsets can override this with the `minWidth` field of their model node. ℹ️ Interpretation rules: - Strings must specify a unit: "px", "em", "rem", "vh", or "vw" (e.g. `tabsetMinWidth: "200px"`) - Percentages (and strings without units) are not allowed |
| `workspaceRef` | `Ref` |  | Exposes the imperative API (see `WorkspaceImperativeHandle`). ℹ️ The `useWorkspaceRef` and `useWorkspaceCallbackRef` hooks are exported for convenience use in TypeScript projects. |
| `renderTabContent` | `function` |  | The content of a tab. Keep it stable (`useCallback`): a new function renders every tab again. |
| `labels` | `Partial<{ separator: string; }>` |  | The words of the Workspace (`WORKSPACE_LABELS`). Translate them. Keep the object stable. |

### WorkspaceTab

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `ref` | `RefCallback<HTMLElement>` |  |  |

### WorkspaceTabClose

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

### WorkspaceToolbarButton

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `glass` | `"clear" \| "dark" \| "light"` |  |  |
| `rounded` | `"default" \| "full"` |  |  |
| `size` | `"default" \| "icon" \| "icon-lg" \| "icon-sm" \| "icon-xs" \| "lg" \| "sm" \| "xl" \| "xs"` |  |  |
| `variant` | `"dashed" \| "default" \| "destructive" \| "destructive-outline" \| "ghost" \| "link" \| "media" \| "outline" \| "secondary"` |  |  |
| `className` | `string` |  |  |
| `busy` | `boolean` |  | The button waits for the app (busy words): a spinner, `aria-busy`, and no clicks. Focus stays on the button. The style hook stays `data-loading`. |
| `spinnerPlacement` | `"center" \| "start"` |  | `center` (default): the spinner covers the label. `start`: it takes the leading icon slot. The icon sizes always use `center`, because their one icon is the label. |

Also takes every prop of Base UI `Button`: https://base-ui.com/react/components/button

### WorkspaceMaximizeButton

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `busy` | `boolean` |  | The button waits for the app (busy words): a spinner, `aria-busy`, and no clicks. Focus stays on the button. The style hook stays `data-loading`. |
| `spinnerPlacement` | `"center" \| "start"` |  | `center` (default): the spinner covers the label. `start`: it takes the leading icon slot. The icon sizes always use `center`, because their one icon is the label. |
| `glass` | `"clear" \| "dark" \| "light"` |  |  |
| `rounded` | `"default" \| "full"` |  |  |
| `size` | `"default" \| "icon" \| "icon-lg" \| "icon-sm" \| "icon-xs" \| "lg" \| "sm" \| "xl" \| "xs"` |  |  |
| `variant` | `"dashed" \| "default" \| "destructive" \| "destructive-outline" \| "ghost" \| "link" \| "media" \| "outline" \| "secondary"` |  |  |
| `labels` | `{ maximize: string; restore: string; }` | DEFAULT_MAXIMIZE_LABELS | Names of the two states. Translate them. |

Also takes every prop of Base UI `Button`: https://base-ui.com/react/components/button

### WorkspaceEmpty

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

### WorkspaceEmptyHeader

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

### WorkspaceEmptyTitle

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

### WorkspaceEmptyDescription

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

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| Workspace | `workspace` | `data-workspace-maximized` |  | `motion-timing` |
| WorkspaceTab | `workspace-tab` | `data-drop-after`, `data-drop-before`, `data-tab-dragging`, `data-tab-placement`, `data-tab-selected`, `data-tabset-active` | `--radius` | `motion-timing` |
| WorkspaceTabClose | `workspace-tab-close` | `data-tab-selected` |  | `hit-area`, `motion-timing` |
| WorkspaceToolbarButton | `workspace-toolbar-button` |  |  |  |
| WorkspaceMaximizeButton | `workspace-maximize-button` | `data-maximized` |  |  |
| WorkspaceEmpty | `workspace-empty` |  |  |  |
| WorkspaceEmptyHeader | `workspace-empty-header` |  |  |  |
| WorkspaceEmptyTitle | `workspace-empty-title` |  |  |  |
| WorkspaceEmptyDescription | `workspace-empty-description` |  |  |  |

## Usage

Give the Workspace a size, a model, and a stable function for the content of each tab.

```tsx title="editor-layout.tsx"
import type { TabNode, WorkspaceModelInput } from "react-resizable-panels";

import { Workspace, WorkspaceMaximizeButton } from "@/components/pro/layout/workspace";

type Panel = { body: string };

const model: WorkspaceModelInput<Panel> = {
  version: 1,
  root: {
    type: "split",
    orientation: "horizontal",
    children: [
      { type: "tabset", size: 30, tabs: [{ id: "files", title: "Files", data: { body: "src/" } }] },
      { type: "tabset", tabs: [{ id: "app", title: "app.ts", data: { body: "export {};" } }] },
    ],
  },
};

function renderPanel(tab: TabNode<Panel>) {
  return <pre className="p-3 text-xs">{tab.data.body}</pre>;
}

function renderToolbar() {
  return <WorkspaceMaximizeButton />;
}

export function EditorLayout() {
  return (
    <div className="h-110 overflow-hidden rounded-lg border">
      <Workspace
        defaultModel={model}
        renderTabContent={renderPanel}
        renderTabsetToolbar={renderToolbar}
      />
    </div>
  );
}
```

## Compose

Build it with:

- [Frame](https://gelatinui.com/components/frame.md): Groups a row of numbers or a summary.
- [Data List](https://gelatinui.com/components/data-list.md): Shows label and value pairs.
- [Count Up](https://gelatinui.com/components/count-up.md): Shows a key number that changes.
- [Badge](https://gelatinui.com/components/badge.md): Shows a level or a status next to a number.
- [Timeline](https://gelatinui.com/components/timeline.md): Shows the recent activity.

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.
- Depth from layers (`layered-neutrals`): Show depth with one step of the neutral tokens (page, card, muted) or one soft shadow, not with many borders or strong shadows.
- Color has a job (`color-has-a-job`): Use color only for a status, the brand action, or data; keep the rest neutral, and show a level with a small mark (a dot, a tinted badge) before a big fill.
- Real content (`real-content`): Fill the UI with content of the real product (real names, amounts, dates, and states), never lorem text or "Item 1".

Patterns: `gelatin://patterns/dashboard-overview`

## Add it

```bash
npx shadcn@latest add @gelatin-ui-pro/workspace
```

It adds 28 registry items: 24 files, 4541 lines, and the npm packages `@base-ui/react`, `@mantine/hooks`, `@phosphor-icons/react`, `clsx`, `motion`, `react-resizable-panels`, `tailwind-merge`, `tailwind-variants`.

## Built on

- [Button](https://gelatinui.com/components/button.md)
- [Empty](https://gelatinui.com/components/empty.md)
- [Resizable](https://gelatinui.com/components/resizable.md)

## 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

- [Resizable](https://gelatinui.com/components/resizable.md)
- [Tabs](https://gelatinui.com/components/tabs.md)
- [Empty](https://gelatinui.com/components/empty.md)
- [Stack](https://gelatinui.com/components/stack.md)
- [Swipe Deck](https://gelatinui.com/components/swipe-deck.md)

## Keyboard

| Keys | Action |
| --- | --- |
| Arrow Left / Arrow Right / Home / End | Move between the tabs of a tabset. |
| Enter | Select the focused tab. |
| Delete | Close the focused tab. |
| Alt + Arrow | Move the focused tab one place along its tab list. |
| Alt + Shift + Arrow | Split the focused tab into a new tabset on that side. |
| Arrow Left / Arrow Right / Arrow Up / Arrow Down | On a focused line between tabsets: resize the tabsets on both sides. |

## Accessibility

Each tab list has the tab roles of the library, and each line between tabsets is a `separator` named "Resize the tabsets" (`labels.separator`, translate it).

The close button is out of the tab order: Delete closes the focused tab.

The maximize button names its state ("Maximize", "Restore"); translate both with `labels`.

## Motion

| Part | Motion |
| --- | --- |
| Selected tab | indicator · the line under the selected tab slides to the new tab (200ms) |
| Drop zone | indicator · the drop zone glides between the regions of a tabset and fades in |
| Drag preview | popup · the tab under the pointer fades and scales in (150ms) |
| Maximize | popup · a maximized tabset fades and scales in over the others |
| Close button | hover · the close button of a tab fades in on hover and on the selected tab (150ms) |
