Documentation

  • 312 sections
  • Solid
  • Tailwind or StyleX

Quick start

The kit is a folder, not a package. Copy dither-kit/ from the GitHub repo (opens in a new tab), install four small runtime deps and alias it. You already have Solid, and Tailwind if you use it.

  1. Copy the kit folder straight from the repo

    degit grabs just the folder

    npx degit drvova/dither-ui/packages/dither-kit/src src/dither-kit
  2. Install the runtime deps

    you already have Solid, and Tailwind if you use it

    npm i d3-scale d3-shape clsx tailwind-merge
  3. Alias @dither-kit so imports stay clean

    // vite.config.ts
    resolve: { alias: { "@dither-kit": "/src/dither-kit/solid" } }
    
    // tsconfig.json, under compilerOptions
    "paths": { "@dither-kit": ["./src/dither-kit/solid"] }
  4. Use it

    import { AreaChart, Area, DitherButton } from "@dither-kit"

One component at a time

Rather take only what you use? One line copies a component and every kit file it imports into src/dither-kit/, in your styling system, with an index of just what you added. Run it again to add more; it never replaces a file you changed, it shows you the difference instead. Every component's page carries its own line.

curl -fsSL https://dither-ui.com/add/dither-add.mjs | node --input-type=module - add DitherButton

Each of these goes after the same node --input-type=module -, and the script keeps your choices in dither-kit.json for the next run:

add DitherButton AreaChart Area   # components and every kit file they need
add DitherWorld --styling stylex  # tailwind, css, modules or stylex
add DitherButton --dry-run        # what would change, nothing written
diff DitherButton                 # what differs between your copy and the site
list                              # every component you can add

Without Tailwind

The kit brings its own stylesheet, in cascade layers so your styles win. Pick your system in the header and every snippet here, every Studio export and the agent's code.get come out as a scoped stylesheet, CSS Modules or StyleX.

<!-- No Tailwind? One plain stylesheet: the tokens, a base scoped to
     .dither-kit and every class the components use. -->
<link rel="stylesheet" href="https://dither-ui.com/kit/dither-kit.css">

<div class="dither-kit">
  <DitherButton class="cta">Ship</DitherButton>
</div>

The tokens are plain custom properties, so theme from CSS, JS or any vars contract:

import { applyTheme, themeCss } from "@dither-kit"

applyTheme({ accent: "#3f8ff3", radius: "4px" })  // on <html>, returns the undo
themeCss({ background: "#000" }, ".dark")          // a rule for your stylesheet

Prefer to read the source first? Every component lives under dither-kit/ (opens in a new tab). No build step, no black box.