tabs
Switch related presentations
interactive 1.0.0 Apache-2.0
Install
docsloth component add @docsloth/tabs@1.0.0 \
--registry https://registry.docsloth.devRun it in a project that has a docsloth.config.json (docsloth init writes one). The docsloth CLI is not on npm yet: it runs from a checkout of the Docsloth engine, and the quickstart shows the setup. Every official component already renders in Docsloth sites; installing one vendors its props schema and specification and pins this exact version and digest.
What the CLI checks
docsloth component add reads this entry from index.json, recomputes the package digest from the manifest and the digest of every file, and writes nothing if one differs.
index.json, lines 871–888871 {872 "name": "@docsloth/tabs",873 "version": "1.0.0",874 "kind": "block",875 "description": "Switch related presentations",876 "license": "Apache-2.0",877 "engine": ">=1 <2",878 "publisher": "docsloth",879 "digest": "sha256:2b5dfd26ede0e42e1f49f55a30405ae643e5dc18fe13460286d0ad1b7f2bcc22",880 "blocks": [881 "tabs"882 ],883 "capabilities": [884 "render.html"885 ],886 "manifest_path": "packages/@docsloth/tabs/1.0.0/manifest.json",887 "files_base": "packages/@docsloth/tabs/1.0.0/files"888 },Trust signals
- Runtime trust class (catalog)
- interactive. Responds to the reader inside the page, such as switching tabs or filtering, with no network access and no secrets.
- Install trust class
- interactive, derived from the declared
render.html. This is the classdocsloth component addanddocsloth component listreport; it installs under the default policy, with no trust policy. - Package
@docsloth/tabs, version1.0.0- Package digest
sha256:2b5dfd26ede0e42e1f49f55a30405ae643e5dc18fe13460286d0ad1b7f2bcc22- Files
- 2 files, each pinned by its own sha256 digest (listed under Package files)
- Capabilities declared
render.html. A declaration, never a grant; every official package declares the same.- Publisher
docsloth, a publisher id rather than a verified identity- Licence
Apache-2.0- Engine range
>=1 <2- Index signature
- Not signed. Digests prove the bytes match the index, not who published them.
- Tools
select_tab- Built from
packages/contracts/component-props/tabs.schema.jsonandpackages/contracts/component-specs/tabs.mdin docsloth-registry
Props
The props schema is packages/contracts/component-props/tabs.schema.json; props it does not list are rejected.
| Prop | Type | Required | Notes |
|---|---|---|---|
title | string | no | maxLength: 160 |
tabs | array<object> | yes | minItems: 1 |
default_id | string | yes | maxLength: 256 |
sync_key | string | no | maxLength: 256 |
Required: tabs, default_id.
Example props generated from the schema
{
"title": "example-title",
"tabs": [
{
"id": "example-id",
"label": "example-label",
"block_ids": [
"00000000-0000-4000-8000-000000000000"
]
}
],
"default_id": "example-default_id",
"sync_key": "example-sync_key"
}Preview
Rendered by @docsloth/renderer from the example document block in the specification.
Document block
{
"type": "tabs",
"props": {
"title": "Install",
"active": 0
},
"children": [
{
"type": "prose",
"props": {
"label": "npm",
"text": "npm add @docsloth/renderer"
}
},
{
"type": "code",
"props": {
"label": "pnpm",
"language": "bash",
"code": "pnpm add @docsloth/renderer"
}
}
]
}pnpm add @docsloth/rendererThis is the renderer's real HTML with this registry's styles. Links and controls in the preview are inactive.
Rendered HTML
<div class="ds-tabs" data-component="tabs">
<div class="ds-tablist" role="tablist" aria-label="Install">
<button type="button" class="ds-tab" role="tab" id="b-tab-0" aria-controls="b-panel-0" aria-selected="true" tabindex="0">npm</button>
<button type="button" class="ds-tab" role="tab" id="b-tab-1" aria-controls="b-panel-1" aria-selected="false" tabindex="-1">pnpm</button>
</div>
<div class="ds-tabpanels">
<div class="ds-tabpanel" role="tabpanel" id="b-panel-0" aria-labelledby="b-tab-0" tabindex="0">
<div class="ds-prose">npm add @docsloth/renderer</div>
</div>
<div class="ds-tabpanel" role="tabpanel" id="b-panel-1" aria-labelledby="b-tab-1" tabindex="0">
<pre class="ds-code" data-lang="bash">
<code>pnpm add @docsloth/renderer</code>
</pre>
</div>
</div>
</div>Specification
From packages/contracts/component-specs/tabs.md.
Contract
Production props are normative in ../contracts/component-props/tabs.schema.json. The corresponding component-fixtures manifest is only a minimal protocol fixture; use the production props schema when building the published package. The packaged artifact ships exactly its generated component-package.json manifest plus props.schema.json (the production props schema, copied byte-for-byte) and spec.md (this spec, copied byte-for-byte); it contains no executable payload, fallback implementation, Storybook, test suite, SSR harness or README. Rendering behavior and the acceptance cases below belong to the renderer and the repository tests, not to the package. Installation pins the package version and the digest of every shipped byte.
Intended behavior
ARIA tabs, arrow keys, retain each panel in readable fallback; sync language preference within version.
React host integration
The official React Tabs uses production tabs, default_id, title and sync_key props. It selects by ID across reordering; removing a selected tab restores the declared default (or the first tab when that default is absent). Arrow keys wrap, Home/End move to either end, and each tab is linked to its panel through ARIA attributes, following the WAI-ARIA tabs pattern.
A host supplies already-authorized, rendered release blocks with the exported ComponentContentProvider from @docsloth/official-components/host. Its blocks prop is a ReadonlyMap<string, ReactNode> and releaseId identifies the publication release. Tabs resolve only their declared block_ids from that map; missing blocks show “Content unavailable.” No block fetch or tool call occurs on selection. The JSON component props remain serializable; the provider is a React host API, separate from those props.
Tabs sharing a sync_key within one provider share the selected ID. Preferences stay in memory, are isolated from other providers, and reset when releaseId changes. The host must change that ID when switching releases. All panels render visibly on the server for readable no-JS fallback; hydration hides inactive panels while keeping their content mounted. This provider does not automatically wire the separate native document renderer or connected executor tools.
<ComponentContentProvider releaseId={release.id} blocks={authorizedRenderedBlocks}>
<Tabs tabs={tabDefinitions} default_id="npm" sync_key="package-manager" />
</ComponentContentProvider>
Failure and fallback
Unknown selected ID resets to declared default, not arbitrary new tab.
Required acceptance cases
No request or write occurs merely by selecting a tab. Also test empty data, loading, denied access, browser without JS, mobile 360px, keyboard navigation, dark mode and an explicit constrained agent tool call. The server independently authorizes capability requests; a package manifest cannot grant authority.
Data and maintenance
Data bindings resolve from a specific publication/release vector and permitted fact/evidence graph. Configuration edits create versioned component patches. Update invalidation uses dependency IDs, never indiscriminate whole-page regeneration. Human-owned props survive automatic updates unless invalidated with an explicit conflict. Missing optional resources leave an honest inert/readable fallback, not a broken page or fake success.
Cost and tools
Pure/local interaction must never invoke a model by accident. Any model, remote query or executor call must reserve approved budget before dispatch. Public visitors do not inherit owner resources. The component may call only named tools in its signed manifest with valid typed inputs. A cancelled job stops polling and closes resources. No component gets platform administration, raw credentials or an unlimited execution loop.
Native renderer block
packages/renderer renders a tabs block from the document IR: children carry props.label and the renderer emits an accessible role="tablist" whose role="tab" buttons wire aria-controls to matching role="tabpanel" panels. Production props for a packaged instance remain normative in ../contracts/component-props/tabs.schema.json.
Native block props
| prop | type | required | behaviour |
|---|---|---|---|
title | string | no | Accessible name of the tablist (aria-label, default Tabs). |
active | integer | no | Zero-based index selected by default; unknown values degrade to the first tab. |
activeTab | string | no | Label or props.id of the selected tab; unknown ids degrade to the first tab. |
children | DocBlock[] | yes | One panel per child; each child needs a non-empty props.label. A missing label degrades the whole block to the labelled fallback. |
Panels stay in the DOM (no hidden) so no-JS and agent readers see every presentation. The tab buttons are content labels, not chrome, so they are not marked data-markdown-ignore; Markdown flattens the block to ### <label> subsections.
Example
{
"type": "tabs",
"props": { "title": "Install", "active": 0 },
"children": [
{ "type": "prose", "props": { "label": "npm", "text": "npm add @docsloth/renderer" } },
{ "type": "code", "props": { "label": "pnpm", "language": "bash", "code": "pnpm add @docsloth/renderer" } }
]
}
Runtime contract
The protocol fixture packages/contracts/component-fixtures/tabs.json records what this component may ask of a host when it runs. It is a contract, not a shipped runtime: the installable package contains no executable code.
| Field | Value |
|---|---|
| Network hosts | none |
| Production writes | not allowed |
| Longest run | 0 seconds |
| Recording | masked |
| Fallback output | html, markdown, json |
| Tool | Effect | Needs confirmation |
|---|---|---|
select_tab | reads only | no |
Package files
Served under packages/@docsloth/tabs/1.0.0/. The package digest covers manifest.json, which lists each file with its digest.
| File | sha256 digest | Bytes |
|---|---|---|
props.schema.json | sha256:9c27e0f9a2cd20e1050eaa553aef4c7db52752923dc1c4569db1cb50cf3c9385 | 1089 |
spec.md | sha256:9d566213e205858a94d0292d579f7aa07afa4435d89cb138525343f7e9d81241 | 5386 |
Sources
| Source | Location |
|---|---|
| Markdown twin | https://registry.docsloth.dev/docs/tabs.md |
| JSON metadata | https://registry.docsloth.dev/api/v1/components/tabs.json |
| Specification | packages/contracts/component-specs/tabs.md |
| Props schema | packages/contracts/component-props/tabs.schema.json |
| Protocol fixture | packages/contracts/component-fixtures/tabs.json |
| Catalog | packages/contracts/component-catalog.json |