Home

Home

Introduce

@sandlada/material-design-css is a CSS library for Material Design. Each style is obtained and written from Material Design 3. Developers can easily use Material Design design tokens such as text-on-primary, bg-surface-container, title-medium, shape-large, etc. through this style library.

CSS styles utilities include:

  • Color
  • Palette
  • Prebuilt Colors
  • Prebuilt Palettes
  • Motion
  • Shape
  • Typography

TailwindCSS v4 is also supported!

Installation

npm i @sandlada/material-design-css

Import

If you are using a development environment such as Vite, you can import the css style file through import in the JS/TS file:

// TypeScript / JavaScript
// Load preset before color or prebuilt-color utilities.
import "@sandlada/material-design-css/preset.css"

// text-on-surface
import "@sandlada/material-design-css/color/text-utilities.css"

// bg-surface
import "@sandlada/material-design-css/color/bg-utilities.css"

// text-primary-0
import "@sandlada/material-design-css/palette/text-utilities.css"

// bg-primary-100
import "@sandlada/material-design-css/palette/bg-utilities.css"

// display-large
import "@sandlada/material-design-css/typography/typography-utilities.css"

// rounded-medium
import "@sandlada/material-design-css/shape/shape-utilities.css"

// animation-easing-expressive-fast-spatial
import "@sandlada/material-design-css/motion/animation-utilities.css"

// transition-easing-expressive-fast-spatial
import "@sandlada/material-design-css/motion/transition-utilities.css"

// Prebuilt Palettes (raw tonal palettes for custom designs)
import "@sandlada/material-design-css/prebuilt-palettes/tonal-spot/h0-2025.css"

// Prebuilt Colors
import "@sandlada/material-design-css/prebuilt-colors/tonal-spot/h0-2025.css"

If you prefer to use CSS files to import css style files:

/* Css */
@import "@sandlada/material-design-css/preset.css";
@import "@sandlada/material-design-css/color/text-utilities.css";
/* ... */

Prebuilt Colors

Prebuilt colors are ready-made color palettes generated by Material Design’s color system. Each CSS file contains light/dark schemes and three contrast levels built in.

import "@sandlada/material-design-css/preset.css"
import "@sandlada/material-design-css/prebuilt-colors/tonal-spot/h0-2025.css"
import "@sandlada/material-design-css/color/text-utilities.css"
import "@sandlada/material-design-css/color/bg-utilities.css"

Toggle the dark attribute on :root to switch between light and dark themes, or use low-contrast / high-contrast attributes to adjust contrast.

Prebuilt Palettes

Prebuilt palettes provide raw reference tonal palettes generated by Material Design’s color system. Unlike prebuilt colors, these are not semantic color schemes — they are low-level palette data you can use to build custom designs.

import "@sandlada/material-design-css/prebuilt-palettes/tonal-spot/h0-2025.css"

Then use the palette tokens in your styles:

.my-element {
    background-color: var(--md-ref-palette-primary-40);
    color: var(--md-ref-palette-primary-90);
}

For detailed prebuilt palette usage, naming conventions, and examples, see the Prebuilt Palettes page.

TailwindCSS v4

@import "tailwindcss";

/**
 * Optional ready-made palette.
 * Replace the path with any file under prebuilt-colors/.
 */
@import "@sandlada/material-design-css/prebuilt-colors/tonal-spot/h0-2025.css";
@import "@sandlada/material-design-css/prebuilt-palettes/tonal-spot/h0-2025.css";

/**
 * bg-primary
 * text-on-primary
 */
@import "@sandlada/material-design-css/color/tailwind-theme.css";

/**
 * bg-primary-90
 * text-primary-10
 */
@import "@sandlada/material-design-css/palette/tailwind-theme.css";

/* rounded-medium */
@import "@sandlada/material-design-css/shape/tailwind-theme.css";

/*
 * font-display-large
 * text-display-large
 * tracking-display-large
 * leading-display-large
 * font-weight-display-large
 */
@import "@sandlada/material-design-css/typography/tailwind-theme.css";

/* display-large */
@import "@sandlada/material-design-css/typography/tailwind-utilities.css";

/**
 * ease-emphasized
 * duration-[var(--duration-medium1)]
 */
@import "@sandlada/material-design-css/motion/tailwind-theme.css";

@layer base {
    :root:not([dark]) {
        color-scheme: light;
    }
    :root[dark] {
        color-scheme: dark;
    }
}

Usage

Copy this code into your configured project and you will see a button with color and rounded corners.

<button class="rounded-medium bg-primary text-on-primary px-4 py-2">
    A rounded button
</button>

Pages

Now that you have completed the installation and import, go to the following page for more usage tutorials: