Skip to content

Workspace

Pro

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.

  • Base UI
  • Motion
  • React 19
  • Tailwind CSS 4

Added Nov 10, 2026 · Pro license

Playground

Loading the preview

Props

Needs your Pro API key in GELATIN_UI_PRO_TOKEN. Set it up

Pro itemAPI key required

Workspace needs a Pro API key

Try the live preview for free. With Pro, the add command above puts the source in your project.

Files it adds
24
More Pro items, one API key
+327
Your coding agent runs it
1 cmd

$79$129once, for life

Already have Pro? Sign in to set up your API key.

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

editor-layout.tsx

Workspace

<div>
PropTypeDefaultDescription
classNamestring—CSS class name.
idstring—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).
styleCSSProperties—CSS properties.
classNamesWorkspaceClassNames—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.
defaultModelRequiredWorkspaceModelInput<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.
disabledboolean—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—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.
elementRefRef<HTMLDivElement | null>—Ref attached to the root HTMLDivElement.
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—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—Content of the element that follows the pointer while a tab is being dragged. Defaults to the tab's title (or id).
renderEmptyTabset—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—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—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. ``tsx 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—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"panel""separator""panel"Controls whether pointer dragging updates sizes immediately, or renders overlay separator previews until the pointer is released.
serverRenderTabContentfalseRender 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.
stylesWorkspaceStyles—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.
tabsetMinHeightstring—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
tabsetMinWidthstring—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—Exposes the imperative API (see WorkspaceImperativeHandle). ℹ️ The useWorkspaceRef and useWorkspaceCallbackRef hooks are exported for convenience use in TypeScript projects.
renderTabContentRequired—The content of a tab. Keep it stable (useCallback): a new function renders every tab again.
labelsPartial<{ separator: string; }>—The words of the Workspace (WORKSPACE_LABELS). Translate them. Keep the object stable.
...props<div> attributes—Every other attribute goes to the <div>.

WorkspaceTab

<div>
PropTypeDefaultDescription
refRequiredRefCallback<HTMLElement>—
...props<div> attributes—Every other attribute goes to the <div>.

WorkspaceTabClose

<div>
PropTypeDefaultDescription
...props<div> attributes—Every other attribute goes to the <div>.

WorkspaceToolbarButton

<button>
PropTypeDefaultDescription
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"—
classNamestring—
busyboolean—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.
From Base UIButtonBase UI docs
focusableWhenDisabledbooleanfalseWhether the button should be focusable when disabled.
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
style—Style applied to the element, or a function that returns a style object based on the component's state.
...props<button> attributes—Every other attribute goes to the <button>, with a ref.

WorkspaceMaximizeButton

<button>
PropTypeDefaultDescription
classNamestring—
busyboolean—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_LABELSNames of the two states. Translate them.
From Base UIButtonBase UI docs
focusableWhenDisabledbooleanfalseWhether the button should be focusable when disabled.
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
style—Style applied to the element, or a function that returns a style object based on the component's state.
...props<button> attributes—Every other attribute goes to the <button>, with a ref.

WorkspaceEmpty

<div>
PropTypeDefaultDescription
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

WorkspaceEmptyHeader

<div>
PropTypeDefaultDescription
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

WorkspaceEmptyTitle

<div>
PropTypeDefaultDescription
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

WorkspaceEmptyDescription

<div>
PropTypeDefaultDescription
...props<div> attributes—Every other attribute goes to the <div>, with a ref.
  • 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.
  • For a fixed set of panes that only resize, use Resizable.
  • For a few views in one place with no drag, use Tabs.
Arrow Left / Arrow Right / Home / EndMove between the tabs of a tabset.
EnterSelect the focused tab.
DeleteClose the focused tab.
AltArrowMove the focused tab one place along its tab list.
AltShiftArrowSplit the focused tab into a new tabset on that side.
Arrow Left / Arrow Right / Arrow Up / Arrow DownOn a focused line between tabsets: resize the tabsets on both sides.

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.

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)

Built with

Installs with Workspace

  1. AddedWorkspace, with Button, Empty, Resizable.
Open the release