npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@urbicon-ui/docs

v8.26.1

Published

Reusable documentation UI components for Urbicon UI docs sites

Readme

@urbicon-ui/docs

Reusable documentation UI components — the pieces the Urbicon UI docs site 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

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.0) 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):

/* 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

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

  const navigation = [
    { id: 'usage', title: 'Usage' },
    { id: 'api', title: 'API' }
  ];
</script>

<DocsLayout title="Button" description="Triggers an action." showToc {navigation}>
  <Section 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. Section ids are the navigation anchors.

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.

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

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

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 | | 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. Section and InfoCard are styled via variant props and class. All components accept class on the root element.

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

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