Workspace
An application shell with a rail, side panels, a header, a toolbar and a status bar.
The rail switches sections; each button’s name shows in a tooltip. The left panel runs the full
height, and beside it the header spans the main column and the right panel. Each panel is
always open from its breakpoint up (md by default; give a second panel xl, so the canvas keeps
room). Below it, the panel lies over the page: the toggle at its end of the header opens it, and a
tap outside or Escape closes it. The canvas scrolls, and the status bar holds counts and state. Give
the workspace a height: the full page, or a box.
Dependencies
What it's built from and what's built from it in Base, read from the imports in its source.
| Uses | ButtonprimitiveScroll AreaprimitiveSidebarTextprimitiveTooltip |
|---|---|
| Used by | Nothing yet. |
| Packages | None. |
Installation
Set the project up for Base once first, as Getting started shows. Then add it with the CLI, or by hand.
With the CLI
Manually
Add the components it uses first, listed under Dependencies.
Then copy the source:
API reference
Generated from Base's types. Props marked ours are added here; the rest come from the ui-sdk part it wraps. Every part also accepts its element's native attributes.
Workspace
The whole workspace. Give it a height: the full page, or a fixed box. It connects the Sidebars inside it to their SidebarTriggers.
Takes the props of a native div.
WorkspaceBody
Everything right of the rail: the header above the columns.
Takes the props of a native div.
WorkspaceCanvas
The scrolling work area. Its content is centered unless you say otherwise.
- orientationours
Which ways it scrolls. Both by default, for work wider than the column, like a page spread. Use
verticalfor content that should wrap to the column's width, like a document.Type "both" | "vertical" · Default both
WorkspaceColumns
Sidebars beside what's between them: the left Sidebar beside the body, and in the body, the main column beside the right one.
Takes the props of a native div.
WorkspaceHeader
The strip along the top of the body: the panel toggles at its ends, usually a breadcrumb between.
Takes the props of a native div.
WorkspaceMain
The middle column.
- variantours
plainsits on the page's background instead of the tinted surface, for reading rather than working.Type "surface" | "plain" · Default surface
WorkspaceRail
The column of section icons down the left edge, with an optional footer.
Takes the props of a native div.
WorkspaceRailButton
A section in the rail: an icon with its name in a tooltip. The active one is filled.
- activeours
Whether this is the section you're in.
Type boolean · Default false
- childrenours
The section's icon.
Type ReactNode
- label*ours
The section's name: the tooltip, and the button's accessible name.
Type string
- sizeours
Height and padding. The
iconsizes are square, for a button holding only an icon.Type NonNullable<"xs" | "sm" | "md" | "lg" | "icon-xs" | "icon-sm" | "icon" | "icon-lg">
- variantours
How much the button stands out.
destructiveis a tint, for actions that can't be undone.Type NonNullable<"primary" | "destructive" | "secondary" | "outline" | "ghost" | "link">
- className
Class names, or a function of the part's state that returns them.
Type string | ((state: ButtonState) => string)
- debug
Logs every state change with its reason to the console, in development builds.
Type boolean
- disabled
Stops presses. The button is natively disabled, so it leaves the tab order and its form doesn't submit through it, unless
focusableWhenDisabledis set.Type boolean · Default false
- focusableWhenDisabled
Keeps a disabled button in the tab order with
aria-disabledinstead of the native attribute, so it can hold focus while it becomes disabled and host a tooltip that says why. Presses still do nothing.Type boolean · Default false
- onClick
Runs when the button is pressed. Return a Promise to make the button pending until it settles: it gets
aria-busy,aria-disabledanddata-pending, keeps focus, ignores presses meanwhile, so a form can't submit twice, and sayspendingAnnouncementafter a second. The event's element is whateverrenderrenders, like a link.details.sourcesays how it was pressed, for changes made after anawait.Type (event: MouseEvent<HTMLElement, MouseEvent>, details: ActionDetails) => unknown
- pendingAnnouncement
What screen readers hear once the button has been pending for a second, so a slow action doesn't pass in silence. Set it in the page's language. An empty string says nothing.
Type string · Default "Loading"
- render
Renders your own element: one that receives the part's props, or a function of the props and the state.
Type RenderProp<ButtonState>
- style
Styles, or a function of the part's state that returns them.
Type CSSProperties | ((state: ButtonState) => CSSProperties)
- type
What a native button does in a form:
"submit"submits it and"reset"resets it. Ignored when the button renders as something else.Type "button" | "submit" | "reset" · Default "button"
WorkspaceRailFooter
Pushes what follows it to the bottom of the rail, like account and theme buttons.
Takes the props of a native div.
WorkspaceStatusBar
The strip along the bottom of the main column, for counts and state.
Takes the props of a native div.
WorkspaceStatusItem
One count or state in the status bar. destructive and warning color its icon.
- toneours
Type "default" | "destructive" | "warning" · Default default
WorkspaceToolbar
A row of tools above the canvas, centered.
Takes the props of a native div.