docslothregistry

tabs

Switch related presentations

interactive 1.0.0 Apache-2.0

Install

docsloth component add @docsloth/tabs@1.0.0 \
  --registry https://registry.docsloth.dev

Run 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–888
871    {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 class docsloth component add and docsloth component list report; it installs under the default policy, with no trust policy.
Package
@docsloth/tabs, version 1.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.json and packages/contracts/component-specs/tabs.md in docsloth-registry

Props

The props schema is packages/contracts/component-props/tabs.schema.json; props it does not list are rejected.

PropTypeRequiredNotes
titlestringnomaxLength: 160
tabsarray<object>yesminItems: 1
default_idstringyesmaxLength: 256
sync_keystringnomaxLength: 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"
      }
    }
  ]
}
npm add @docsloth/renderer
pnpm add @docsloth/renderer

This 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

proptyperequiredbehaviour
titlestringnoAccessible name of the tablist (aria-label, default Tabs).
activeintegernoZero-based index selected by default; unknown values degrade to the first tab.
activeTabstringnoLabel or props.id of the selected tab; unknown ids degrade to the first tab.
childrenDocBlock[]yesOne 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.

FieldValue
Network hostsnone
Production writesnot allowed
Longest run0 seconds
Recordingmasked
Fallback outputhtml, markdown, json
ToolEffectNeeds confirmation
select_tabreads onlyno

Package files

Served under packages/@docsloth/tabs/1.0.0/. The package digest covers manifest.json, which lists each file with its digest.

Filesha256 digestBytes
props.schema.jsonsha256:9c27e0f9a2cd20e1050eaa553aef4c7db52752923dc1c4569db1cb50cf3c93851089
spec.mdsha256:9d566213e205858a94d0292d579f7aa07afa4435d89cb138525343f7e9d812415386

Sources

SourceLocation
Markdown twinhttps://registry.docsloth.dev/docs/tabs.md
JSON metadatahttps://registry.docsloth.dev/api/v1/components/tabs.json
Specificationpackages/contracts/component-specs/tabs.md
Props schemapackages/contracts/component-props/tabs.schema.json
Protocol fixturepackages/contracts/component-fixtures/tabs.json
Catalogpackages/contracts/component-catalog.json