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

@etchteam/storybook-addon-design-token-tables

v2.0.0

Published

Storybook addon for design token tables

Downloads

172

Readme

Storybook Design Token Tables

A Storybook addon that provides a custom doc block for displaying design tokens in formatted tables within Storybook MDX files.

Installation

npm install --save-dev @etchteam/storybook-addon-design-token-tables
# or
yarn add -D @etchteam/storybook-addon-design-token-tables

Usage

This addon provides a <Tokens> component that you can use in your Storybook MDX files to display design tokens from your CSS variables in well-formatted tables with previews.

Step 1: Configure the addon in your Storybook preview file

In your .storybook/preview.js (or .storybook/preview.ts), configure the addon by providing:

  1. Your design tokens CSS (imported as raw text)
  2. A mapping of token collection prefixes to display types
// .storybook/preview.js
import rawTokens from '../src/tokens.css?raw';

import '../src/tokens.css'; // Also import your tokens for styling

const preview = {
  parameters: {
    designTokenTables: {
      // Map CSS variable prefixes to display types
      collections: {
        palette: 'color',
        'font-family': 'font-family',
        'font-size': 'font-size',
        'font-weight': 'font-weight',
        'line-height': 'line-height',
        radius: 'radius',
        shadow: 'shadow',
        spacing: 'spacing',
        opacity: 'opacity',
      },
      // Array of CSS with token definitions (as raw strings)
      tokens: [
        rawTokens,
      ],
    }
  },
};

export default preview;

Step 2: Create MDX files for your design tokens

Create MDX files that use the <Tokens> component to display your design tokens:

// Colors.mdx
import { Meta } from '@storybook/addon-docs/blocks';
import { Tokens } from '@etchteam/storybook-addon-design-token-tables';

<Meta title="Design Tokens/Colors" />

# Colors

<Tokens collection="palette" />

The collection prop should match one of the token prefixes you configured in your preview file.

Supported Token Types

The addon supports displaying and previewing various types of design tokens:

  • Colors - Shows color swatches
  • Font Families - Shows text previews with the font applied
  • Font Sizes - Shows text at the specified size
  • Font Weights - Shows text with the specified weight
  • Line Heights - Shows text with applied line height
  • Border Radii - Shows visual preview of border radius
  • Spacing - Shows visual representation of spacing values
  • Shadows - Shows preview of shadow effects
  • Opacity - Shows preview with the specified opacity level

Token Format

The addon expects tokens to be defined as CSS custom properties in a :root selector:

:root {
  --palette-red: #ff0000;
  --spacing-sm: 0.5rem;
  --radius-md: 0.5rem;
  /* etc. */
}

The naming pattern should follow: --collection-name: value;

Example

See the /demo folder in this repository for a complete working example.

License

MIT