WorkspaceShell
Give the parent a definite height. Place page content in children, side panels in sidebar and inspector, and navigation in rail. The optional title bar uses --ac-sys-size-titleBar. The status bar stays beneath the pane area.
Live example
Open playground ↗Overview
App.tsx
import '@ancrel/tokens/css'
import '@ancrel/workspace/styles.css'
import './example.css'
import { WorkspaceShell } from '@ancrel/workspace'
export default function App() {
return <section aria-label="Report workspace" className="report-workspace">
<WorkspaceShell titleBar="Report" sidebar={<button>Contents</button>}
inspector="Revision 2" statusBar="Ready" theme="light" density="compact">
<h1>Overview</h1>
</WorkspaceShell>
</section>
}
Expected behavior
A light, compact workspace shows Contents, Overview and Revision 2 in separate wide panes. Below 768px the title bar offers Show sidebar and Show inspector. Show sidebar focuses Contents. Back to main restores focus to Show sidebar.
At container widths of 768px and above, the shell passes its panes and split options to ResizableSplit. Each pane scrolls independently. Use mainAs="div" inside an existing main landmark. Theme and density apply to this shell and its descendants, so nested previews can set either axis independently.
Below narrowBreakpoint, the title bar provides buttons for the available side panes. Opening a pane focuses its first available control or the pane itself. Returning to the main pane restores focus to the corresponding title-bar button. Supply labels to translate those buttons.
For local state, choose the starting pane with defaultNarrowPane. For controlled navigation, pass narrowPane and update it in onNarrowPaneChange. Install the appearance with @ancrel/tokens/css and @ancrel/workspace/styles.css.
Props
| Prop | Type | Required | Default |
|---|---|---|---|
children | ReactNode | Yes | — |
className | string | No | — |
defaultNarrowPane | ShellPane | No | — |
density | Density | No | — |
inspector | ReactNode | No | — |
key | React.Key | null | undefined | No | — |
labels | Partial<{
showSidebar: string;
showInspector: string;
backToMain: string;
}> | No | — |
mainAs | 'main' | 'div' | No | — |
narrowBreakpoint | number | No | — |
narrowPane | ShellPane | No | — |
onNarrowPaneChange | ((pane: ShellPane) => void) | undefined | No | — |
rail | ReactNode | No | — |
ref | React.Ref<HTMLDivElement> | undefined | No | — |
sidebar | ReactNode | No | — |
split | Pick<ResizableSplitProps, 'leftConfig' | 'rightConfig' | 'minCenterWidth' | 'persistKey' | 'storage' | 'labels' | 'onWidthsChange'> | No | — |
statusBar | ReactNode | No | — |
theme | Theme | No | — |
titleBar | ReactNode | No | — |
State matrix
| State | Theme / density |
|---|---|
| default | dark/compact, dark/comfortable, light/compact, light/comfortable |
| focus-visible | dark/compact, dark/comfortable, light/compact, light/comfortable |
Constraints
- Give the parent a definite height.
- Use mainAs="div" when embedding the shell in an existing main landmark.
Anti-patterns
- Using viewport width to select the narrow pane.
- Setting document-wide theme attributes for a local preview.