Skip to content

Token Table

Display color tokens in a structured table with swatches, names, variables, and any metadata you need.

Usage

Use markdown table syntax inside a :::colors block. The first column must be a color value, and the remaining columns can be any metadata:

md
:::colors
| Color | Token | CSS Variable | Purpose |
| ------- | ------- | ----------------- | ------------------- |
| #0059b3 | primary | --color-primary | Primary brand color |
| #3381cc | light | --color-light | Lighter shade |
| #003a7a | dark | --color-dark | Darker shade |
:::

The header row and separator row (---) are optional. If included, they become column headers. The first column is always rendered as a swatch + color value. Click any non-color cell to copy its text to the clipboard.

Requirement

This feature requires colorPreviewPlugin in your VitePress config. See Getting Started for setup.

Examples

Brand Palette

ColorTokenCSS VariablePurpose
#0059b3
primary--color-primaryPrimary brand color
#3381cc
primaryLight--color-primary-lightLighter shade (hover)
#003a7a
primaryDark--color-primary-darkDarker shade (active)
#ffffff
onPrimary--color-on-primaryText on primary background
#6c757d
secondary--color-secondarySecondary brand color
#868e96
secondaryLight--color-secondary-lightLighter secondary shade
#494f54
secondaryDark--color-secondary-darkDarker secondary shade

Status Colors

ColorTokenCSS VariablePurpose
#22c55e
success--color-successSuccess feedback
#f59e0b
warning--color-warningWarning alerts
#ef4444
danger--color-dangerError states
#3b82f6
info--color-infoInformational messages

Without Headers

You can skip the header and separator rows — columns render without labels:

Color
#0059b3
primary--color-primaryPrimary brand color
#3381cc
primaryLight--color-primary-lightLighter shade
#003a7a
primaryDark--color-primary-darkDarker shade

Minimal (Two Columns)

ColorToken
#ef4444
danger
#f97316
warning
#eab308
caution
#22c55e
success
#3b82f6
info

Tailwind Tokens

Tailwind classes also work in the color column:

ColorTokenUsage
bg-blue-500
primaryButtons, links
bg-gray-100
surfaceCard backgrounds
bg-red-500
errorError messages
bg-green-500
successSuccess indicators