Components for displaying structured data — tables, diagrams, colors, and version-specific content.
Tables
DocsLit supports three table styles:
Markdown (GFM) — small, simple tables in plain Markdown
wc-table — a table from JSON in two attributes, with sticky headers
wc-asciidoc-table — AsciiDoc syntax for spans, column specs, multi-line cells, and CSV/DSV — see AsciiDoc tables
wc-table reads its data from two attributes, headers and rows. Both are JSON. Wrap the attribute values in single quotes so the double quotes inside the JSON stay intact. The element has no body.
<wc-table headers='["Command","Description","Default"]' rows='[["init","Scaffold a new project","my-docs"],["dev","Start dev server","port 3000"],["build","Generate static site","dist/"],["validate","Check project health","-"]]'></wc-table>
A JSON array of header strings, such as ["Name","Type"].A JSON array of rows, each an array of cell values, such as [["a","b"]].
Sticky header and search
Wrap an ordinary Markdown table in wc-table to add a sticky header, a live search box, or both. Leave a blank line between the tags and the table. Type in the box to filter rows:
Keep the header row visible while the table body scrolls. The scroll area height is max-height.
Show a search box that filters rows as you type, as a case-insensitive substring match.
The placeholder and accessible label of the search box.
The maximum height of the scroll area, as any CSS length. With sticky the default is 70vh.Use Markdown tables for most tables, because they are easier to write and to read in source. Use wc-table when the data is already JSON. Use wc-asciidoc-table when you need AsciiDoc features such as cell spans, column widths, or CSV input.
Mermaid diagrams
Render diagrams with wc-mermaid:
<wc-mermaid>graph LR A[Write Markdown] --> B[docslit build] B --> C[Static HTML] B --> D[Search Index] B --> E[llms.txt]</wc-mermaid>
graph LR
A[Write Markdown] --> B[docslit build]
B --> C[Static HTML]
B --> D[Search Index]
B --> E[llms.txt]
Mermaid diagrams support flowcharts, sequence diagrams, class diagrams, and more. Click the expand icon to view diagrams in a larger modal.
Mermaid is large, so the first diagram on a page loads it from jsDelivr (pinned to Mermaid 10.9.8). Without network access, the diagram source is shown instead.
Colors
Show swatches with wc-color, grouped in a wc-colors container. Click a swatch, or focus it and press Enter, to copy its value.
<wc-colors><wc-color value="#3b82f6" name="Primary" variable="--color-primary"></wc-color><wc-color value="#10b981" name="Success" variable="--color-success"></wc-color><wc-color light="#ffffff" dark="#0b0b0b" name="Surface"></wc-color></wc-colors>The color in any CSS format: hex, rgb(), hsl(), oklch() and so on. hex is an older alias.
The color shown, and copied, in light mode.
The color shown, and copied, in dark mode.
The display name shown next to the swatch.
A CSS custom property name for the color. It is copied instead of the value.
Layouts
wc-colors has two layouts. The default compact variant is a grid:
The table variant adds a titled row per group, which suits design-system pages with scales:
<wc-colors variant="table"><wc-color-row title="Brand"><wc-color name="brand-500" value="#0ea5e9"></wc-color><wc-color name="brand-700" value="#0369a1"></wc-color></wc-color-row><wc-color-row title="Neutral"><wc-color name="gray-100" value="#f3f4f6"></wc-color><wc-color name="gray-900" value="#111827"></wc-color></wc-color-row></wc-colors>The layout: compact for a swatch grid, or table for titled rows made of wc-color-row.
The label of the row. Inline Markdown works.
Show different content based on the selected version with wc-versions and wc-version:
<wc-versions><wc-version name="0.2">The `build` command now generates `llms.txt` and `llms-full.txt` automatically.</wc-version><wc-version name="0.1">Run `docslit build` to generate your static site.</wc-version></wc-versions>
The build command now generates llms.txt and llms-full.txt automatically.
Run docslit build to generate your static site.
The label on the switcher button, such as 0.2. The attribute is name, not version.The name of the version shown first. Defaults to the first child.
The version the content applies to.
The audience or user role the content applies to, such as admin. The older name role also works, but audience avoids a clash with the ARIA role attribute.