DreamLake

TabbedContainer

A tab strip joined to one content frame. It generalizes the raised file-tab geometry of Dockit's code-block tabs to arbitrary React content. Colors use neutral UIKit surface, ink and hairline tokens in light and dark themes.

Background tabs have rounded rectangular fills inset equally above and below. Their labels keep the same padding and vertical position when selected; hovering changes the fill without adding a tab-shaped border. The shared --uikit-document-inactive-inset, --uikit-document-inactive-bg, and --uikit-document-hover-bg variables also apply here.

One shared starting point.

tsx
<TabbedContainer
  aria-label="Spawn alternatives"
  activationMode="hover"
  items={[
    { value: "right", label: "Spawn right", children: <RightExample /> },
    { value: "below", label: "Spawn below", children: <BelowExample /> },
  ]}
/>

Use value and onValueChange for controlled selection, or defaultValue for uncontrolled selection. keepMounted defaults to true so inactive content keeps its local state; hidden panels are inert and absent from keyboard navigation. Set it false for disposable scenario branches. className styles the shell; contentClassName styles its panels.

Arrow keys, Home and End select and focus tabs. Every tab and panel has linked ARIA IDs. Long labels remain on one line in a horizontally scrollable strip. The layout controller examples use this container to fork commands from one shared starting layout.

Set activationMode="hover" to switch on mouse hover without moving keyboard focus. The default is click. Touch still selects by tapping, and click and keyboard controls work in both modes. The layout examples enable hover for quick comparisons.

Contextual actions

Put a small group of actions for the visible view at the right of the tab row, instead of adding another header or toolbar. An item's actions show only while that tab is active; the container's actions show for every tab, after the active tab's own. The tab strip keeps the remaining width and scrolls when labels do not fit, so the actions never push the frame wider.

Question, primary chart and conclusion.

tsx
<TabbedContainer
  aria-label="Experiment views"
  actions={<Button variant="ghost" size="sm" children="Open memo" />}
  items={[
    { value: "overview", label: "Overview", children: <Overview /> },
    {
      value: "runs",
      label: "Runs 25",
      actions: (
        <Button variant="ghost" size="sm" children="Copy launch command" />
      ),
      children: <RunsTable />,
    },
  ]}
/>