CodeTabs
Tabs over code that mirrors a reader's choice — package manager, framework, language.
View code
<CodeTabs
syncKey="framework"
aria-label="Framework"
tabs={[
{ label: "Remix", value: "remix", children: <CodeBlock title="app/routes.ts" language="ts" code={remixRoutes} labels={labels} /> },
{ label: "Hono", value: "hono", children: <CodeBlock title="src/index.ts" language="ts" code={honoApp} labels={labels} /> },
]}
/>Demo docs sites
Whole pages built only from @sdxc/ui, each for an invented product with its own palette and type. They open in a new tab.
- Content docsDriftwood DocsGuides for Driftwood, a command line that deploys static sites: a tutorial, how-to guides and concept pages./demo/docs/driftwood
- Component docsLattice DocsDocs for Lattice UI, a component library: an index of components, each with live previews, props and accessibility notes./demo/docs/lattice
- API referenceParcelo DocsThe HTTP API reference for Parcelo, a shipping-label API: resources, endpoints with request and response fields, and examples in three languages./demo/docs/parcelo
- Utilities docsTempo DocsReference for Tempo, an invented library of CSS utilities: every spacing, colour, layout, type and effect utility drawn beside its call and the CSS it emits./demo/docs/tempo
Every demo, landings and docs sites alike, is listed in the demo gallery.
Installation
An ordinary dependency: install it, import the theme once, and import the component where it is used.
npm add @sdxc/ui remiximport "@sdxc/ui/theme.css";Usage
import { CodeTabs } from "@sdxc/ui/docs";Renders the strip of tabs over a stack of panels that share one grid cell, so the set is as tall as its tallest panel and switching never moves the page. The selected tab's underline grows in over 150ms, and holds still under reduced motion.
Props
Read from the component's own types, so every prop, every default and every allowed value is listed.
| Prop | Type | Required | Description |
|---|---|---|---|
tabs | readonly Tab[] | Yes | |
syncKey | string | No | Every set with this key on the page switches together, such as package-manager. |
persist | CodeTabsPersistence | No | Where a synced choice is remembered between pages: cookie lets the server render it (read it with readCodeTabsCookie and pass selected), local restores it after hydration, and none only syncs this page. Defaults to local. |
selected | string | No | The value of the tab to render selected, such as the reader's remembered choice. Defaults to the first tab. |
"aria-label" | string | Yes | Names the strip of tabs for assistive technology, such as "Package manager". |
Also accepts everything in Omit<TagProps<"form">, "children" | "aria-label">.