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

m3-tokens-react

v0.1.0

Published

Material 3 design tokens, ThemeProvider, and components generated 1:1 from a Figma design kit token export.

Readme

m3-tokens-react

Material 3 design tokens, a React ThemeProvider, and components (Button, Card, Chip) generated 1:1 from a Figma Material 3 design kit token export. Every token keeps its original Figma name and carries a figmaPath so you can always trace a value back to the design file.

Install

npm install m3-tokens-react

React 18 or newer is required (it's a peer dependency).

Quick start

Wrap your app in the theme provider. It puts every token on the page as a CSS custom property (like --md-sys-color-primary) and handles light/dark switching:

Import the stylesheet once (for example in your app entry file), then wrap your app in the theme provider:

import "m3-tokens-react/styles.css";
import { M3ThemeProvider } from "m3-tokens-react";

export default function App() {
  return (
    <M3ThemeProvider defaultScheme="light">
      <YourApp />
    </M3ThemeProvider>
  );
}

Use the components

import { M3Button, M3Card, M3Chip } from "m3-tokens-react";

<M3Button variant="filled" onClick={save}>Save</M3Button>
<M3Card variant="elevated">Card content</M3Card>
<M3Chip variant="filter" selected>Popular</M3Chip>

The components load Roboto sizes and weights from the type scale tokens, so add Roboto to your page (for example via Google Fonts) for faithful rendering.

Use the tokens directly

In CSS, reference any token as a variable — these update automatically when the scheme changes:

.banner {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  box-shadow: var(--md-sys-elevation-level1);
}

In React, read tokens and control the scheme with the hook:

import { useM3Theme, m3Tokens } from "m3-tokens-react";

function SchemeToggle() {
  const { scheme, toggleScheme } = useM3Theme();
  return <M3Button variant="outlined" onClick={toggleScheme}>
    Switch to {scheme === "light" ? "dark" : "light"}
  </M3Button>;
}

// The full token tree is also available as data:
m3Tokens.schemes.light.colors["md-sys-color-primary"].value; // "#6750a4ff"
m3Tokens.typescale["md-sys-typescale-body-large"].fontSize;  // 16

What's inside

  • System colors — md-sys-color-* for light and dark, plus elevation surface tints
  • State layers — md-sys-state-layers-<name>-opacity-<percent> for hover/press states
  • Reference palettes — six tonal palettes (md-ref-palette-primary40, ...)
  • Type scale — 15 styles (md-sys-typescale-display-large, ...) with full metrics
  • Elevation — five levels as ready-to-use box-shadow values per scheme
  • Every token has a figmaPath tracing it to the original Figma export

Regenerating from Figma

Token data is generated from the Figma token export by scripts/generate.mjs. To pick up a new export, replace the source JSON and run:

npm run generate
npm run build

The generator validates that every token name is a legal CSS custom property name and fails loudly if an export would break the theme.