React

Manual

Learn how to install and use Crispy without bundler integration.

Install Dependencies

Install the required dependencies.

npm install @seed-design/react @seed-design/css

Modify index.html

Crispy's color tokens switch between light/dark modes through the data-seed-color-mode and data-seed-user-color-scheme attributes on the <html /> tag.

Theming

Check detailed explanations and usage methods for theming attributes.

index.html
<html
  data-seed
  data-seed-color-mode="system"
  data-seed-user-color-scheme="light"
>
  <head>
    <meta name="color-scheme" content="light dark" />
    <script>
    /* user-color-scheme setup script, modify as needed */
    try {
      var prefersDark = window.matchMedia('(prefers-color-scheme: dark)');

      if ('addEventListener' in prefersDark) {
        prefersDark.addEventListener('change', apply);
      } else if ('addListener' in prefersDark) {
        prefersDark.addListener(apply);
      }

      if (prefersDark.matches) {
        document.documentElement.dataset.seedUserColorScheme = 'dark';
      } else {
        document.documentElement.dataset.seedUserColorScheme = 'light';
      }

      function apply() {
        document.documentElement.dataset.seedUserColorScheme = prefersDark.matches ? 'dark' : 'light';
      }
    } catch (e) {}
    </script>
  </head>
</html>

Import all.css

To reduce stylesheet size, you can separately import base.css and each component's stylesheet. If using a bundler, you can automatically load component stylesheets through the bundler guide at the top of the documentation.

index.tsx
import "@seed-design/css/all.css";

Create seed-design.json

npx @seed-design/cli@latest init

seed-design Configuration

◇  Are you using TypeScript?
│  Yes
│
◇  Are you using React Server Components?
│  No
│
◇  Enter the seed-design folder path. (default is created at project root)
│  ./seed-design

Try using a component

npx @seed-design/cli@latest add ui:action-button
tsconfig.json
{
  "compilerOptions": {
    // ... your options
    "paths": {
      "seed-design/*": [
        "./seed-design/*"
      ]
    }
  }
}

Getting Started with Stackflow

Learn how to set up the Crispy Stackflow plugin to use Crispy AppScreen.

Table of contents