docslothregistry

badge

Compact status label

pure 1.0.0 Apache-2.0

Install

docsloth component add @docsloth/badge@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 115–132
115    {116      "name": "@docsloth/badge",117      "version": "1.0.0",118      "kind": "block",119      "description": "Compact status label",120      "license": "Apache-2.0",121      "engine": ">=1 <2",122      "publisher": "docsloth",123      "digest": "sha256:861bab9e5ab9cd4fcd541c879097947bc594509657e038e1129ae02381954717",124      "blocks": [125        "badge"126      ],127      "capabilities": [128        "render.html"129      ],130      "manifest_path": "packages/@docsloth/badge/1.0.0/manifest.json",131      "files_base": "packages/@docsloth/badge/1.0.0/files"132    },

Trust signals

Runtime trust class (catalog)
pure. Renders content only: no side effects, no network access and no permission prompts.
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/badge, version 1.0.0
Package digest
sha256:861bab9e5ab9cd4fcd541c879097947bc594509657e038e1129ae02381954717
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
none
Built from
packages/contracts/component-props/badge.schema.json and packages/contracts/component-specs/badge.md in docsloth-registry

Props

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

PropTypeRequiredNotes
textstring | numberno
labelstring | numbernoAlias for text.
tone"info" | "success" | "warning" | "danger" | "neutral"no
prefixstringnomaxLength: 40

No prop is required.

Example props generated from the schema
{
  "text": "Stable",
  "label": "Stable",
  "tone": "info",
  "prefix": "status"
}

Preview

Rendered by @docsloth/renderer from the example document block in the specification.

Document block
{
  "type": "badge",
  "props": {
    "text": "Stable",
    "tone": "success",
    "prefix": "status"
  }
}
status: Stable

This is the renderer's real HTML with this registry's styles. Links and controls in the preview are inactive.

Rendered HTML
<span class="ds-badge" data-component="badge" data-tone="success">
<span class="ds-badge-prefix">status:</span> Stable</span>

Specification

From packages/contracts/component-specs/badge.md.

Contract

Packaged: this block ships as @docsloth/badge@1.0.0 — an installable component package (kind block, capability render.html, Apache-2.0) whose production props schema is packages/contracts/component-props/badge.schema.json and whose catalog entry is in packages/contracts/component-catalog.json. No protocol manifest fixture is published (manifest_fixture: null): the fixture models a packaged protocol runtime this block does not have.

Intended behavior

Inline status pill: a <span class="ds-badge"> carrying a tone and an optional textual prefix. Markdown renders the same message as inline code with the prefix inside it (` status: Stable `), so state survives copy/paste, diffs and agent extraction instead of relying on color alone. JSON keeps the raw props for machine consumers.

Failure and fallback

Missing/empty text (or a non-string, non-finite-number value) degrades to the labelled fallback block. An unknown tone degrades to info without losing the message, and a non-string prefix falls back to the default status prefix. No prop shape throws.

Required acceptance cases

Assert the tone whitelist (info, success, warning, danger, neutral), that prefix and text appear in both HTML and Markdown, that no live-region/role="status" semantics are claimed, and that HTML/Markdown visible text matches. Also test missing text, an unknown tone, unknown extra props, mobile 360px, 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

Block type: badge. Renderer: packages/renderer/src/index.ts (native, no permission surface).

Native block props

proptyperequiredbehaviour
textstring | numberyesBadge message; label is accepted as an alias.
toneinfo | success | warning | danger | neutralnoVisual tone (default info); unknown values degrade to info.
prefixstringnoTextual prefix before the message (default status); an empty string omits it.

Example

{ "type": "badge", "props": { "text": "Stable", "tone": "success", "prefix": "status" } }

Markdown: ` status: Stable `.

Package files

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

Filesha256 digestBytes
props.schema.jsonsha256:57d57170c4fd814e63a4416b2d65682dcd0f0a743e26d661259d56349990a4d5961
spec.mdsha256:42251031f200c2ae7780a9b4687ca4eab48a6c316d2c7708fbee7024eb7e5be43227

Sources

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