# @knapsack/design-system

> The Knapsack React design system: shadcn/ui on Base UI with Tailwind, styled only by design tokens.

Latest version **4.2.0** (published 2026-11-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install @knapsack/design-system
pnpm add @knapsack/design-system
yarn add @knapsack/design-system
bun add @knapsack/design-system
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 4.2.0 |
| Published | 2026-11-19 |
| First published | 2026-11-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | evanlovely, illepic, jfrenette |
| Keywords | design-system, react, shadcn, tailwindcss, tanstack-intent |

## Links

- npm: https://www.npmjs.com/package/@knapsack/design-system
- Repository: https://github.com/knapsack-labs/design-system
- Homepage: https://github.com/knapsack-labs/design-system/tree/main/packages/design-system#readme
- Issues: https://github.com/knapsack-labs/design-system/issues
- npm.io page: https://npm.io/package/@knapsack/design-system

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 4.2.0 (latest) — 2026-11-19
- 4.1.0 — 2026-11-18

## README

# @knapsack/design-system

The Knapsack React design system: [shadcn/ui](https://ui.shadcn.com/) on [Base UI](https://base-ui.com/) in shadcn's `nova` style, with `lucide-react` icons and `cva` variants, styled with Tailwind v4 against design tokens from `@knapsack/tokens`. Published as built ESM, type declarations and CSS in `dist/`. `Stack` and `Text` are the system's layout and type primitives; the color-scheme API handles light and dark.

**Using it in an app:** start at [docs/getting-started.md](./docs/getting-started.md). The whole consumer guide is indexed in [docs/README.md](./docs/README.md), [DESIGN.md](./DESIGN.md) is the short entry point for an agent, and agent skills ship in `skills/` ([TanStack Intent](https://tanstack.com/intent/latest) layout).

## What you need to know first

**Nothing is styled by a value that is not a token.** Colour, spacing, radius, type, motion, opacity and control sizing all come from `@knapsack/tokens`; elevation is flat by rule (a ring, a border, a scrim) and has no token.

**Use the utility, not the variable.** Colours are shadcn's role names, so `bg-primary text-primary-foreground`, `border-input` and `ring-ring` are tokens. Scales generate utilities too (`p-lg`, `gap-sm`, `text-md`, `font-medium`, `rounded-xl`, `rounded-full`, `ease-standard`). Where Tailwind has no namespace, use the arbitrary form: `h-(--size-target-md)`, `size-(--size-icon-md)`, `opacity-(--opacity-disabled)`, `duration-(--transition-duration-fast)`, `border-(length:--border-width-thin)`. A bare `transition-*` utility already runs on the fast duration and `ease-standard`, because `@knapsack/tokens` points Tailwind's default transition there.

**Both stylesheets are needed.** An app imports `@knapsack/design-system/shadcn.css` after the token and theme stylesheets, and points Tailwind's `@source` at this package, because Tailwind's detection skips `node_modules`. [docs/getting-started.md](./docs/getting-started.md) has the exact lines.

## Brands and the colour scheme

Two independent axes, both normally on `<html>`:

- **Brand:** `data-theme="<id>"` on `<html>` for the app, or on any element for a subtree. Themes nest.
- **Scheme:** the `dark` class, shadcn's convention, so `dark:` utilities work. It combines with any brand: each brand defines every role in both schemes.

In an app, mount `ColorSchemeProvider` once at the root and inline `COLOR_SCHEME_BOOT_SCRIPT` in `<head>` before any stylesheet, so a dark-scheme user never sees a light flash. `ColorSchemeToggle` offers Light, Dark and System; `useColorScheme()` returns `{ preference, scheme, setPreference }`. The choice persists in `localStorage` under `COLOR_SCHEME_STORAGE_KEY` (`ks-color-scheme`); `system` follows `prefers-color-scheme` live. The provider never touches `data-theme`.

## What a component accepts

**The shadcn components keep shadcn's open surface:** the element's props, spread, and shadcn's compound names (`Card`, `CardHeader`, `CardTitle`, `CardContent`, `CardFooter`). `Button` takes `onClick` and `disabled`; a trigger composes another element through Base UI's `render` prop (`<DropdownMenuTrigger render={<Button variant="ghost" />} />`).

**`Stack` and `Text` stay closed**, on `ConsumerProps`: `id`, `className`, `ref`, `role`, `children`, `aria-*`, `data-*`, and `tabIndex` as `-1 | 0` only. No `style`, no handlers. `as` is a union: `Stack` takes `div | section | nav | ul | ol | li`, `Text` takes `p | span | h1..h6 | pre`.

Every component merges `className` with `cn()` (exported as `cn`), so a consumer's class wins.

## Licence

MIT, in [LICENSE](./LICENSE). The Golos Text fonts in `dist/fonts/` are under the SIL Open Font License.

---
_Source: https://npm.io/package/@knapsack/design-system · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
