# @urbicon-ui/docs

> Reusable documentation UI components for Urbicon UI docs sites

Latest version **8.36.0** (published 2026-11-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install @urbicon-ui/docs
pnpm add @urbicon-ui/docs
yarn add @urbicon-ui/docs
bun add @urbicon-ui/docs
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 8.36.0 |
| Published | 2026-11-03 |
| First published | 2026-06-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 562.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 4 |
| Maintainers | urbicon |
| Keywords | svelte, documentation, ui, components |

## Links

- npm: https://www.npmjs.com/package/@urbicon-ui/docs
- Repository: https://github.com/urbicon/ui
- Homepage: https://ui.urbicon.de
- Issues: https://github.com/urbicon/ui/issues
- npm.io page: https://npm.io/package/@urbicon-ui/docs

## Alternatives

- [@progress/kendo-ooxml](https://npm.io/package/@progress/kendo-ooxml.md) — 152.1K weekly downloads
- [@progress/kendo-react-ripple](https://npm.io/package/@progress/kendo-react-ripple.md) — 8.0K weekly downloads
- [@progress/kendo-react-orgchart](https://npm.io/package/@progress/kendo-react-orgchart.md) — 4.3K weekly downloads
- [@praxisui/dynamic-fields](https://npm.io/package/@praxisui/dynamic-fields.md) — 2.4K weekly downloads
- [@progress/kendo-vue-listbox](https://npm.io/package/@progress/kendo-vue-listbox.md) — 932 weekly downloads

## Recent versions

- 8.36.0 (latest) — 2026-11-03
- 8.35.0 — 2026-10-24
- 8.34.0 — 2026-10-23
- 8.33.0 — 2026-10-21
- 8.32.0 — 2026-10-19
- 8.31.0 — 2026-10-17
- 8.30.0 — 2026-10-12
- 8.29.0 — 2026-10-11
- 8.28.1 — 2026-10-10
- 8.28.0 — 2026-10-10
- 8.27.0 — 2026-10-09
- 8.26.1 — 2026-10-04
- 8.26.0 — 2026-09-24
- 8.25.0 — 2026-09-22
- 8.23.0 — 2026-09-15
- … 109 more at https://npm.io/package/@urbicon-ui/docs/versions

## README

# @urbicon-ui/docs

Reusable documentation UI components — the pieces the [Urbicon UI docs site](https://ui.urbicon.de) is built from: page layout with scrollspy ToC, code examples with live preview, API/type reference tables, and an interactive prop playground. Part of the Urbicon UI monorepo.

## Installation

```bash
bun add @urbicon-ui/docs @urbicon-ui/blocks @urbicon-ui/table @urbicon-ui/i18n @urbicon-ui/shared-types shiki @shikijs/langs
```

All of these (plus `svelte` ^5.57.1) are **peer dependencies** — the package bundles none of them:

- **`shiki`** (^4.4.3) + **`@shikijs/langs`** — syntax highlighting. `CodePanel` / `CodeExample` highlight through a shared, **synchronous** highlighter (`highlighterService`) with the package's editorial light/dark themes: Shiki's `Sync` core, its JavaScript regex engine, and ten statically imported grammars. Synchronous is the point — an awaited highlighter can only be driven from an effect, effects do not run during SSR, and the prerendered page then carries a spinner where the code should be. It also costs less over the wire: measured on this project's built bundles, ~333 → 121 KB gz for a page with code, because Vite inlines Shiki's oniguruma WASM as a 225 KB gz JavaScript chunk that the JS engine makes unnecessary. The eager half grows in exchange (44 → 121 KB gz); the full measurement is at the top of `utils/highlighter.ts`. Both are peers so your app controls the version and the grammars are not double-bundled next to an app-level install.
- **`@urbicon-ui/blocks`** — the components compose blocks primitives (Card, Badge, Button, …) and the semantic token layer.
- **`@urbicon-ui/table`** — `ApiReference` and `TypesReference` render their prop/type tables via `<Table>`.
- **`@urbicon-ui/i18n`** — built-in strings ship as a package-scoped `docs.*` namespace (EN/DE).
- **`@urbicon-ui/shared-types`** — `PlaygroundConfigurator` control definitions.

### Styles

Import the stylesheets after Tailwind, blocks first — none of them imports Tailwind or each other (that stays the app's responsibility, and a stylesheet imported twice is emitted twice):

```css
/* app.css */
@import 'tailwindcss';
@import '@urbicon-ui/blocks/style/index.css';
@import '@urbicon-ui/docs/style/index.css';
@import '@urbicon-ui/table/style/index.css'; /* table styles used by ApiReference/TypesReference */
```

## Quick Start

```svelte
<script lang="ts">
  import { Button } from '@urbicon-ui/blocks';
  import { CodeExample, DocsLayout, Section } from '@urbicon-ui/docs';
</script>

<DocsLayout title="Button" description="Triggers an action." showToc>
  <Section marker id="usage" title="Usage">
    <CodeExample title="Basic" language="svelte" code={`<Button intent="primary">Save</Button>`}>
      <Button intent="primary">Save</Button>
    </CodeExample>
  </Section>
</DocsLayout>
```

`DocsLayout` renders the page header (optionally with `breadcrumbs`, a `stability` badge, and a `sourceHref` link), a sticky scrollspy table of contents on desktop, and a collapsible ToC fallback on mobile. The table of contents is built from the page's own sections: every titled `Section` is listed under its heading, in the order it renders, and its `id` is the anchor. `marker` numbers a section by its position among the numbered ones.

### Vite plugin — no duplicated example code

The `./vite` export ships `codeExamplePlugin`: for every `<CodeExample isolate>` it extracts the children markup at build time and injects it as the `code` prop — the live preview **is** the displayed source, written once.

```ts
// vite.config.ts
import { codeExamplePlugin } from '@urbicon-ui/docs/vite';

export default defineConfig({
  plugins: [codeExamplePlugin(), tailwindcss(), sveltekit({ adapter: adapter() })]
});
```

## Components

| Component                | Purpose                                                                                                     |
| ------------------------ | ----------------------------------------------------------------------------------------------------------- |
| `DocsLayout`             | Page layout: header, breadcrumbs + collapsing sticky bar, stability badge, responsive ToC column            |
| `Section`                | Content section with anchor `id`, title/subtitle, badges, optional semantic footer                          |
| `TableOfContents`        | Sticky "On this page" nav with scrollspy, optional related-links block and global code toggle               |
| `CodeExample`            | Code example with optional live preview, syntax highlighting, and copy-to-clipboard                         |
| `CodePanel`              | Shared code-display primitive: Shiki highlighting, collapsible panel, auto line numbers, copy button        |
| `ApiReference`           | Structured props table (rendered via `@urbicon-ui/table`) with source/required badges and opt-in type links |
| `TypesReference`         | Expandable type definitions with literal-value badges and cross-links to the API reference                  |
| `ReferenceSections`      | A component page's API Reference and Types sections, both tables fed from one generated `componentData`     |
| `PlaygroundConfigurator` | Interactive prop playground: live preview, control panel, generated code                                    |
| `InfoCard`               | Memo-style callout card for notes and tips; renders as a link when `href` is set                            |

Also exported: `CodeVisibilityStore` (+ context helpers) for a page-global expand/collapse-all-code toggle, `ScrollSpy` for active-section tracking, `extractPlaygroundDocs` / `extractLiteralValues` for deriving playground control metadata from generated API props, and `highlighterService` — the shared Shiki singleton the code components highlight through (`highlightCode(code, language)` returns a string, not a promise).

## Styling

`ApiReference`, `CodeExample`, `CodePanel`, `DocsLayout`, `PlaygroundConfigurator`, `TableOfContents`, and `TypesReference` support `unstyled` + per-slot `slotClasses`, following the [blocks styling conventions](https://github.com/urbicon/ui/blob/main/packages/blocks/README.md). `Section` and `InfoCard` are styled via variant props and `class`. All components accept `class` on the root element, except `ReferenceSections`, which renders two sections and no element of its own and takes no styling props — to restyle that part of a page, compose `Section`, `ApiReference` and `TypesReference` yourself.

## i18n

Built-in strings (copy buttons, ToC headings, playground labels) register as the `docs.*` namespace via `@urbicon-ui/i18n`, with EN/DE bundles. They resolve against the locale of a surrounding `<I18nProvider>` — or the base locale (`en`) when none is mounted, so the components work with zero i18n setup.

## Development

```bash
bun --filter='@urbicon-ui/docs' run dev     # svelte-package watch
bun --filter='@urbicon-ui/docs' run build   # svelte-package
bun --filter='@urbicon-ui/docs' run test    # vitest
bun --filter='@urbicon-ui/docs' run check   # svelte-check
```

## Related

- [Urbicon UI docs site](https://ui.urbicon.de) — its documentation chrome is built with these components
- [`@urbicon-ui/blocks`](https://github.com/urbicon/ui/blob/main/packages/blocks/README.md) — the component library these docs components compose
- [`@urbicon-ui/table`](https://github.com/urbicon/ui/blob/main/packages/table/README.md) — renders the API/type reference tables
- [`@urbicon-ui/i18n`](https://github.com/urbicon/ui/blob/main/packages/i18n/README.md) — locale provider the `docs.*` namespace plugs into

---
_Source: https://npm.io/package/@urbicon-ui/docs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
