# TDPXL > TDPXL is a React design system built for humans and AI agents: Tailwind v4 components on an oklch role-based token scale, distributed through a registry that copies the source into your project (not an npm library). Every component ships usage metadata, an accessibility contract and machine-checkable rules. - Catalogue: 71 components, 2 hooks, 70 charts, 31 blocks. - Install with the TDPXL CLI (`@thedesignproject/tdpxl`, binary `tdpxl`): `npx @thedesignproject/tdpxl init`, then `npx @thedesignproject/tdpxl add `. Install TDPXL items only with the TDPXL CLI. Pre-release: the CLI is not on npm yet; run the local build (`node packages/cli/dist/index.js`). - After installing, read `.meta.json` next to each component and the TDPXL section of your AGENTS.md (`npx @thedesignproject/tdpxl add guide`), then run `npx @thedesignproject/tdpxl check` to verify contrast and style rules. - Style with semantic roles (`bg-primary-base`, `text-sub-600`), never raw palette classes, hex values or `dark:` variants. Button uses `intent`, `emphasis` and `size`, not `variant`. - Machine-readable: registry index https://tdpxl.designproject.io/r/registry.json, items https://tdpxl.designproject.io/r/.json, agent manifest https://tdpxl.designproject.io/ai/manifest.json, full text https://tdpxl.designproject.io/llms-full.txt. A local MCP server (`@thedesignproject/tdpxl-mcp`, pre-release) exposes the same data as tools. This file concatenates the TDPXL guides in full and a condensed entry per catalogue item (purpose, API summary, when to use and avoid, accessibility contract, focused examples). Each entry links to its complete markdown page. # Guides ## Introduction Docs: https://tdpxl.designproject.io/docs/index.md > A design system built on a role scale. The source is copied into your project. TDPXL is two things that hold each other up. **A token system** organised by role rather than by color. A component writes `text-sub-600`, never `text-gray-600`, so the day the palette changes there is nothing to go looking for. It is explained in [Tokens](https://tdpxl.designproject.io/docs/tokens.md). **A registry** that distributes that system. It is not an npm library: the CLI fetches a JSON document and writes the source into your repository. From that point the file is yours. ### What is in the box - **Tailwind v4** with no config file. The tokens live in CSS. - **Radix UI** for the accessible behaviour of the primitives. - **cva** for variants, `cn()` for merging classes without conflicts. - A registry served as static JSON, installed with `npx @thedesignproject/tdpxl add`. ### Why a registry instead of a package A package gives you an API. A registry gives you the code. The difference shows up the day you need to change something internal: with a package you open an issue, with a registry you open the file. The cost is real and worth stating: updates do not arrive on their own. If a bug is fixed in the registry, projects that already copied the component keep their copy until they run `npx @thedesignproject/tdpxl diff` to see what changed and `npx @thedesignproject/tdpxl update` to bring it in without losing their own edits. ### Where to start 1. [Installation](https://tdpxl.designproject.io/docs/installation.md) — set up Next.js or Vite and add your first component. 2. [Using components](https://tdpxl.designproject.io/docs/using-components.md) — how to choose, install, read and adapt a component. 3. [Tokens](https://tdpxl.designproject.io/docs/tokens.md) and [Theming](https://tdpxl.designproject.io/docs/theming.md) — the role scale, and how to make it yours. 4. [CLI](https://tdpxl.designproject.io/docs/cli.md) — every command, flag and what it does to your files. 5. [AI agents](https://tdpxl.designproject.io/docs/ai.md) — the guidance and tools a coding agent reads. 6. [Registry](https://tdpxl.designproject.io/docs/registry.md) — how items are built, and hosting your own. To browse what exists, use the [component gallery](https://tdpxl.designproject.io/components), the [charts](https://tdpxl.designproject.io/charts) and the [blocks](https://tdpxl.designproject.io/blocks). ## Installation Docs: https://tdpxl.designproject.io/docs/installation.md > Set up a Next.js or Vite project, run init, and add your first component. TDPXL is not an npm dependency of your app. The `@thedesignproject/tdpxl` command copies each component's source into your project, together with the registry items and npm packages it imports. From then on the files are yours. ### Requirements - **React 19** or later. React 18 is not supported: components receive `ref` as a regular prop, which React 18 drops. - **Next.js 15.5+ or 16** (App Router), or **Vite 8** with `@vitejs/plugin-react`; React Router 8 works in a Vite project. - **Tailwind CSS v4**, listed in `package.json` and imported from one stylesheet with `@import "tailwindcss"`. `init` stops on Tailwind v3. - **A TypeScript path alias**, such as `"@/*": ["./*"]` in `tsconfig.json` (or `tsconfig.app.json`). The CLI resolves every destination folder through it. - **Node.js 20.9** or later (20, 22 and 24 are tested) to run the CLI. Every combination above is installed and built from scratch in CI with a representative set of components, a chart and a block. ### Next.js `create-next-app` already produces a project that meets every requirement when you accept Tailwind CSS and the default `@/*` alias: ```bash npx create-next-app@latest my-app cd my-app npx @thedesignproject/tdpxl init ``` `init` finds `app/globals.css` (or `src/app/globals.css`) because it imports Tailwind. Blocks are written into your App Router directory, `app/` or `src/app/`. ### Vite Start from the React + TypeScript template and add Tailwind v4 with its Vite plugin: ```bash npm create vite@latest my-app -- --template react-ts cd my-app npm install tailwindcss @tailwindcss/vite npm install -D @types/node ``` Replace the contents of `src/index.css` with: ```css @import "tailwindcss"; ``` Add the alias to **both** `tsconfig.json` and `tsconfig.app.json`, so the editor and the CLI can resolve it: ```json { "compilerOptions": { "baseUrl": ".", "paths": { "@/*": ["./src/*"] } } } ``` Then teach Vite the same alias and register the Tailwind plugin in `vite.config.ts`: ```ts import path from "node:path" import tailwindcss from "@tailwindcss/vite" import react from "@vitejs/plugin-react" import { defineConfig } from "vite" export default defineConfig({ plugins: [react(), tailwindcss()], resolve: { alias: { "@": path.resolve(__dirname, "./src") }, }, }) ``` Now run: ```bash npx @thedesignproject/tdpxl init ``` Components land in `src/components/ui/`, hooks in `src/hooks/`, `cn()` in `src/lib/utils.ts`. Blocks are written for the Next.js App Router; in a Vite project they go to `src/components//` instead, and the authentication blocks will not compile there because they import `next/link`. See [Blocks](https://tdpxl.designproject.io/blocks). ### What init does ```bash npx @thedesignproject/tdpxl init ``` 1. Detects the framework (Next.js, Vite or unknown) from `package.json`. 2. Checks that Tailwind CSS is v4 and that a path alias exists. 3. Finds the stylesheet that imports Tailwind among `app/globals.css`, `src/app/globals.css`, `src/index.css`, `src/styles/globals.css`, `styles/globals.css`, `src/globals.css` and `src/App.css`. Pass `--css ` to choose another one; if none matches, it asks. 4. Writes `tdpxl.json` with the registry location, that stylesheet and the aliases for `components`, `ui`, `hooks`, `lib` and `utils`. See the [tdpxl.json reference](https://tdpxl.designproject.io/docs/cli.md#tdpxljson). 5. Installs two registry items: **`utils`** (the `cn()` helper, with `clsx` and `tailwind-merge`) and **`theme`** (the tokens, with `tw-animate-css`). If `tdpxl.json` already exists, `init` asks before replacing it; `--force` replaces it, together with the theme section. ### What changes in your CSS The `theme` item never touches what you wrote. It appends one managed section to the stylesheet, delimited by two comments: ```css @import "tailwindcss"; @import "tw-animate-css"; @custom-variant dark (&:is(.dark *)); /* tdpxl:theme:start … */ :root { --white-0: #ffffff; --strong-950: oklch(0.185 0.0084 264); --primary-base: oklch(0.468 0.1716 264); /* …every semantic role, light values */ } .dark { --white-0: oklch(0.185 0.0084 264); /* …the same roles, dark values */ } @theme inline { --color-white-0: var(--white-0); --color-sub-600: var(--sub-600); /* …one --color- per role, then --radius-* and --shadow-* tokens */ } @layer base { /* border color, body background/text/font, focus-visible outline */ } @utility text-label-sm { /* …typography utilities */ } /* tdpxl:theme:end */ ``` - **`:root` and `.dark`** hold the semantic roles (`weak-50`, `sub-600`, `primary-base`, `error-lighter`…) as plain CSS variables. Dark mode only reassigns them. - **`@theme inline`** exposes each role to Tailwind as `--color-`, which is what makes utilities such as `bg-weak-50`, `text-sub-600` or `border-soft-200` exist, plus the radius (`rounded-10`) and shadow (`shadow-regular-md`) tokens. - **Typography utilities** such as `text-label-sm` and `text-paragraph-md` are added with `@utility`. - `@import "tw-animate-css"` is inserted after your last existing `@import`, and `@custom-variant dark` is added only if the file does not already declare one. Later, `npx @thedesignproject/tdpxl update theme` brings in a new theme version and only ever touches the text between the markers (edits you made there are merged). Put your own overrides outside them; see [Theming](https://tdpxl.designproject.io/docs/theming.md). Dark mode is a `.dark` class on an ancestor, usually ``; see [Dark mode](https://tdpxl.designproject.io/docs/dark-mode.md). ### Add components ```bash npx @thedesignproject/tdpxl add button npx @thedesignproject/tdpxl add card dialog sidebar ``` The CLI resolves each item's registry dependencies, writes every file, rewrites the internal imports to your aliases and installs the npm packages your `package.json` does not have yet, with the package manager your lockfile indicates. Then import the component from where it landed: ```tsx import { Button } from "@/components/ui/button" export function Save() { return } ``` `npx @thedesignproject/tdpxl list` shows everything the registry offers. Every flag is described in [CLI](https://tdpxl.designproject.io/docs/cli.md). Each install is recorded in `tdpxl-lock.json`, and the registry source it came from is kept in `.tdpxl/base/`. Commit both: they let `npx @thedesignproject/tdpxl diff` and `npx @thedesignproject/tdpxl update` bring in new versions without losing your edits. See [Staying up to date](https://tdpxl.designproject.io/docs/cli.md#staying-up-to-date). ## CLI Docs: https://tdpxl.designproject.io/docs/cli.md > Commands, flags, tdpxl.json, and exactly what the CLI does to your files. The CLI is published as `@thedesignproject/tdpxl`; its binary is `tdpxl`. Run it with `npx` (or `pnpm dlx`, `bunx`, `yarn dlx`) from the root of your project: ```bash npx @thedesignproject/tdpxl [options] ``` ### Commands #### init ```bash npx @thedesignproject/tdpxl init ``` Checks Tailwind v4 and the path alias, finds the stylesheet that imports Tailwind, writes `tdpxl.json` and installs the `utils` and `theme` items. See [Installation](https://tdpxl.designproject.io/docs/installation.md#what-init-does) for each step. | Flag | Effect | | --- | --- | | `--css ` | The stylesheet that imports Tailwind, when detection picks the wrong one or none | | `-f`, `--force` | Replace an existing `tdpxl.json` and the theme section without asking | | `-y`, `--yes` | Never prompt | | `--skip-install` | Do not install npm packages; print them instead | | `--registry ` | Registry to record in `tdpxl.json` | | `--cwd ` | Project directory (default: the current directory) | #### add ```bash npx @thedesignproject/tdpxl add npx @thedesignproject/tdpxl add button dialog npx @thedesignproject/tdpxl add use-mobile chart-bar-stacked dashboard-01 ``` Resolves each item and all of its registry dependencies (depth first, each item once), writes the files, rewrites imports and installs missing npm packages. Requires `tdpxl.json`, so run `init` first. | Flag | Effect | | --- | --- | | `-o`, `--overwrite` | Replace existing files that differ | | `-y`, `--yes` | Never prompt; keep differing files unless `--overwrite` | | `--dry-run` | Print what would be created, updated or skipped and which packages would be installed; write nothing | | `--skip-install` | Do not install npm packages; print them instead | | `--registry ` | Use this registry instead of the one in `tdpxl.json` | | `--cwd ` | Project directory | #### list ```bash npx @thedesignproject/tdpxl list npx @thedesignproject/tdpxl list --type ui npx @thedesignproject/tdpxl list --type block --json ``` Prints the registry catalogue grouped by type. `--type` accepts `ui`, `hook`, `block`, `lib` or `theme`; charts and blocks are both `block`. `--json` prints `name`, `type`, `title` and `description` for each item. `list` also works outside a project: without `tdpxl.json` it reads the default registry. #### diff ```bash npx @thedesignproject/tdpxl diff npx @thedesignproject/tdpxl diff button theme npx @thedesignproject/tdpxl diff --json ``` For each installed item (or the ones named), compares three things: the version in `tdpxl-lock.json` with the registry's, each local file with what was installed (were you editing it?), and the local file with what the new version would write. It prints the state of every file that is not up to date and a unified diff from the local copy to the new registry output, after the same import rewriting `add` does. Writes nothing. | State | Meaning | | --- | --- | | `update` | The registry changed; your copy did not. `update` replaces it | | `modified` | You edited it; the registry has nothing new. `update` leaves it alone | | `diverged` | Both changed. `update` merges them (three-way) | | `missing` | The registry changed and you deleted the file. Restored only with `--force` | | `added` | The new version ships a file the installed one did not | | `removed` | The new version no longer ships this file | `--json` prints `{ registry, items: [{ name, installed, latest, newer, upstreamChanged, localModified, files: [{ path, target, kind, state, localModified, upstreamChanged, baseAvailable, diff }] }] }`. #### update ```bash npx @thedesignproject/tdpxl update # every installed item npx @thedesignproject/tdpxl update button --dry-run npx @thedesignproject/tdpxl update button --merge ``` Brings installed items to the registry's version, file by file: - **Not edited locally:** replaced with the new version. - **Edited locally:** three-way merge. The base is what the installed version wrote (rebuilt from `.tdpxl/base/`), *ours* is your file and *theirs* is the new version, both after import rewriting. Changes to different regions combine; the result is written and keeps counting as edited. - **Conflicts:** the file is skipped and reported, and the item stays at its installed version for that file. With `--merge` the file is written with git-style markers (`<<<<<<< local`, `=======`, `>>>>>>> tdpxl `) for you to resolve. New registry dependencies of the new version are added, and missing npm packages are installed as in `add`. Exit code 1 when a file was skipped or written with conflict markers. | Flag | Effect | | --- | --- | | `--dry-run` | Print what each file would get (`updated`, `merged`, `conflict`, `skipped`…); write nothing | | `--merge` | Write conflict markers instead of skipping conflicting files | | `-f`, `--force` | Replace files the registry changed, discarding your edits to them | | `--json` | Machine-readable result | | `--skip-install`, `--registry`, `--cwd` | As in `add` | To discard edits to a file the registry has not changed, use `add --overwrite`. #### remove ```bash npx @thedesignproject/tdpxl remove card npx @thedesignproject/tdpxl remove card --dry-run ``` Deletes the files an item installed and its record. Files you edited are kept (it asks in a terminal; `--force` deletes them). The theme and `AGENTS.md` sections are removed from their files, leaving the rest. If other installed items depend on it, it warns and stops unless you confirm or pass `--force`. npm packages are never uninstalled: the CLI lists the ones no remaining TDPXL item needs, for you to remove if nothing else imports them. #### check ```bash npx @thedesignproject/tdpxl check npx @thedesignproject/tdpxl check contrast npx @thedesignproject/tdpxl check rules --json ``` Re-checks the contrast of your theme in both modes and the style rules of the installed components, and suggests passing values for brand roles that fail. Exits with code 1 on failure, so it can run in CI. What it checks is explained in [Customizing](https://tdpxl.designproject.io/docs/customizing.md#what-tdpxl-check-does). `-h`/`--help` and `-v`/`--version` are available on every command. ### tdpxl.json `init` writes this file at the project root. Every later command reads it. ```json { "registry": "", "css": "app/globals.css", "aliases": { "components": "@/components", "ui": "@/components/ui", "hooks": "@/hooks", "lib": "@/lib", "utils": "@/lib/utils" } } ``` | Key | Meaning | | --- | --- | | `registry` | Where items are fetched from: an HTTP(S) base URL or a local folder of item JSON files | | `css` | The stylesheet that receives the theme section | | `aliases.ui` | Destination and import path for components (`registry:ui`) | | `aliases.hooks` | Destination and import path for hooks | | `aliases.components` | Destination for charts, and for blocks outside a Next.js App Router project | | `aliases.lib` | Destination for library files | | `aliases.utils` | The file `cn()` is written to and imported from | The aliases use the prefix of your path alias (`@` for `"@/*"`). Each alias is resolved to a folder through the `paths` in `tsconfig.json`, `tsconfig.app.json` or `jsconfig.json`, so with `"@/*": ["./src/*"]` the `ui` alias writes to `src/components/ui/`. When the registry is an HTTP URL, `init` also adds a `$schema` entry pointing at the registry's config schema. You can edit the file by hand, for example to put components in `@/components/tdpxl`. Later `add` commands write and import accordingly. ### Where files land | Item type | Example | Destination | | --- | --- | --- | | `registry:ui` | `button` | `/button.tsx` | | `registry:hook` | `use-mobile` | `/use-mobile.ts` | | `registry:lib` | `utils` | `.ts` | | `registry:block` (chart) | `chart-bar-stacked` | `/chart-bar-stacked.tsx` | | `registry:block` (block) | `dashboard-01` | `app/dashboard/page.tsx` and `app/dashboard/components/*` in Next.js; `/dashboard/…` otherwise | | `registry:theme` | `theme` | The managed section of the `css` file | In a Next.js project the App Router directory is `src/app` or `app`, whichever exists. ### How imports are rewritten Registry sources import each other through the registry's own layout. On the way in, the CLI rewrites those specifiers to your aliases: | In the registry | In your project | | --- | --- | | `@/registry/ui/` | `/` | | `@/registry/hooks/` | `/` | | `@/registry/charts/` | `/` | | `@/registry/lib/utils`, `@/lib/utils` | `` | Relative imports inside a block are left alone: the block's files keep their relative positions, so `./components/app-sidebar` still resolves. ### Staying up to date Every registry item has a `version` (semver, starting at 0.1.0) and a `sha256` hash of each file as published, before any import rewriting (`cssHash` for the theme). The CLI verifies those hashes and refuses content that does not match. `add` and `update` record what they installed in **`tdpxl-lock.json`**, next to `tdpxl.json`: ```json { "lockfileVersion": 1, "items": { "button": { "version": "0.1.0", "type": "registry:ui", "registryDependencies": ["spinner", "theme", "utils"], "dependencies": ["class-variance-authority@^0.7.1", "radix-ui@^1.8.1"], "files": [ { "path": "registry/ui/button.tsx", "type": "registry:ui", "kind": "file", "target": "src/components/ui/button.tsx", "source": "sha256:…", "written": "sha256:…" } ] } } } ``` `source` is the hash of the registry content; `written` the hash of what that version writes in your project (after rewriting imports). A file whose hash is not `written` has been edited. For the theme and `AGENTS.md`, only the managed section between the markers is hashed and merged (`kind: "theme"` / `"agents"`), so your CSS and notes around it never count as edits. **`.tdpxl/base//`** keeps the registry source of each installed file: the common ancestor `update` merges against. Commit `tdpxl-lock.json` and `.tdpxl/` so every teammate and CI sees the same state. Without the base, an edited file cannot be merged and `update` asks for `--merge` (one conflict over the whole file) or `--force`. The lock is a separate file, not part of `tdpxl.json`, because it is machine written and changes on every install or update; `tdpxl.json` stays the short file you edit by hand. Projects installed before the lock existed have no records: run `add ` again (identical files are left alone) to start tracking them. ### When a file already exists - **Identical content:** left alone and reported as unchanged. - **Different content, interactive terminal:** the CLI asks before replacing it. - **Different content with `--yes`, or without a terminal (CI):** skipped and reported with `(exists, use --overwrite)`. - **`--overwrite`:** replaced. - **Already installed and untouched** (per `tdpxl-lock.json`): replaced without asking, since there are no edits to lose. - **Already installed, edited, and the registry has nothing new:** kept and reported as `(local edits kept)`. Dependencies that are already installed are not refreshed by `add`; if the registry has a newer version, `add` points you to `tdpxl diff`. The theme is the one exception on a first install: appending the managed section never touches your own CSS, so it is written without asking. Replacing an existing section follows the rules above, because it may discard edits made between the markers. The summary marks each file with `+` created, `~` updated or `×` skipped, and counts unchanged files. ### npm packages Each item lists the npm packages its source imports. After writing files, the CLI installs the ones missing from your `package.json` (dependencies and devDependencies both count as present) with the package manager it detects from the nearest lockfile — `pnpm-lock.yaml`, `bun.lock`/`bun.lockb`, `yarn.lock` or `package-lock.json`, searching parent folders for monorepos — and falls back to the manager that launched the CLI, then npm. With `--skip-install` it prints the list so you can install them yourself. ### Registry location The registry is resolved in this order: 1. `--registry` on the command line. 2. `registry` in `tdpxl.json` (for `add` and `list`). 3. The `TDPXL_REGISTRY` environment variable, then the CLI's built-in default (for `init`, and for `list` outside a project). A registry can be a URL or a local folder. A folder is read straight from disk, which is how you test a registry before deploying it: ```bash npx @thedesignproject/tdpxl add button --registry ../my-registry/public/r TDPXL_REGISTRY=https://registry.example.com/r npx @thedesignproject/tdpxl init ``` Inside an item, `registryDependencies` are bare names (`"button"`), always resolved against the registry you are installing from. See [Registry](https://tdpxl.designproject.io/docs/registry.md) to host your own. ### Current limits - `update` compares lines; two edits on adjacent lines (with no unchanged line between them) are a conflict even when they do not overlap, as in `git merge`. - Re-running `add` on a file edited before `tdpxl-lock.json` existed records it as an edit of the current registry version. If your copy started from an older version, its first `update` may report more conflicts than necessary. - Several blocks share a route (`dashboard`, `login`, `signup`). Adding a second one finds the existing `page.tsx` and skips it unless you pass `--overwrite`. ## AI agents Docs: https://tdpxl.designproject.io/docs/ai.md > Built for humans and AI agents. llms.txt, markdown pages, an MCP server, AGENTS.md rules and tdpxl check give a coding agent the same guidance a person reads. Every page, rule and example in these docs also exists in a form a coding agent can read without a browser. All of it is generated from the same sources as the human docs, so an agent and a person never read two different APIs. | Resource | What it holds | Where | | --- | --- | --- | | `llms.txt` | Overview, install, and a link to every doc page as markdown ([llmstxt.org](https://llmstxt.org) convention) | [/llms.txt](https://tdpxl.designproject.io/llms.txt) | | `llms-full.txt` | The guides in full, plus a condensed entry per item: purpose, API summary, when to use and avoid, accessibility contract, focused example code | [/llms-full.txt](https://tdpxl.designproject.io/llms-full.txt) | | Markdown pages | Any docs page as plain markdown: add `.md` to its path | `/docs/components/button.md` | | Registry | One JSON document per item, with source and `.meta.json` | `/r/registry.json`, `/r/.json` | | Agent manifest | Exports and props from source, contracts, accessibility requirements, usage metadata | `/ai/manifest.json` | | MCP server | The above as tools, plus the contrast check | `@thedesignproject/tdpxl-mcp` (local build, below) | ### llms.txt and markdown pages Point an agent at `/llms.txt` when it needs to find its way, and at `/llms-full.txt` when it should load the whole system at once (about 1 MB). Each docs page is also served as markdown at the same path plus `.md`, for example `/docs/theming.md` or `/docs/components/dialog.md`; links inside those pages point at other `.md` pages. The files are generated by `pnpm llms:build` (part of `pnpm build`). Links are root-relative unless `TDPXL_BASE_URL` is set at build time, in which case they are absolute. ### MCP server `@thedesignproject/tdpxl-mcp` (binary `tdpxl-mcp`) is a read-only [Model Context Protocol](https://modelcontextprotocol.io) server over stdio. It reads the registry, the agent manifest and these docs, and reaches no network beyond the registry you configure. | Tool | Returns | | --- | --- | | `list_items` | Items filtered by kind (component, hook, chart, block), category or search words | | `get_item` | Usage metadata v2, source-derived API, accessibility contract, dependencies, files and docs link | | `get_examples` | Focused official example code with consumer import paths; source files for charts and blocks | | `get_install_command` | The `@thedesignproject/tdpxl add` command, resolved registry dependencies and npm packages | | `get_rules` | The consumer `AGENTS.md` section, `tdpxl/rules.json` and the visual rules; per component with `component` | | `check_theme` | The same contrast check as `tdpxl check contrast`, on stylesheet text or a project path, with suggested fixes | | `search_docs` | Ranked doc sections with snippets and markdown links | #### Use the local build > **Not published yet** > > `@thedesignproject/tdpxl-mcp` is not on npm. Build it from a clone of the TDPXL repository and > point your editor at `packages/mcp/dist/index.js` with an absolute path. ```bash pnpm install pnpm mcp:build # writes packages/mcp/dist/index.js pnpm mcp:test # unit, in-process and stdio tests ``` **Claude Code**, from your project: ```bash claude mcp add tdpxl -- node /absolute/path/to/tdpxl/packages/mcp/dist/index.js ``` or commit a project-scoped `.mcp.json`: ```json { "mcpServers": { "tdpxl": { "command": "node", "args": ["/absolute/path/to/tdpxl/packages/mcp/dist/index.js"] } } } ``` **Cursor**: the same `mcpServers` object in `.cursor/mcp.json` (project) or `~/.cursor/mcp.json` (global). **VS Code** (Copilot agent mode), in `.vscode/mcp.json`: ```json { "servers": { "tdpxl": { "type": "stdio", "command": "node", "args": ["/absolute/path/to/tdpxl/packages/mcp/dist/index.js"] } } } ``` #### Configuration | Variable | Default | Effect | | --- | --- | --- | | `TDPXL_REGISTRY` | the repository's `public/r` in a TDPXL checkout, otherwise `https://tdpxl.designproject.io/r` | Registry folder or URL, e.g. `http://localhost:4000/r` while `pnpm dev` runs. Its parent holds `ai/` and `llms-full.txt`. | | `TDPXL_MCP_ROOTS` | the server's working directory | Directories `check_theme` may read a project from (separated like `PATH`). Paths are resolved through symlinks, and the stylesheet must stay inside the project. | | `TDPXL_MCP_LIVE` | off | `1` re-reads data that changed instead of keeping the first copy for the life of the server. Same as the `--live` flag. | #### Working on TDPXL itself: live data By default the server reads each file once and keeps it until it restarts, and the files it reads are generated. While you change TDPXL, that means an agent can answer from components, metadata or docs that are no longer true, with nothing to tell it so. Two pieces close that gap: ```bash pnpm mcp:dev # regenerates the MCP data on every change to registry/, lib/, # governance/, content/docs/ and components/demos/ ``` and the server started with `--live`, so it re-reads whatever changed: ```bash claude mcp add tdpxl -- node /absolute/path/to/tdpxl/packages/mcp/dist/index.js --live ``` A local file is re-read when its modification time or size changes; with a URL registry, `--live` fetches on every call. If a generator fails, `mcp:dev` says so and the server keeps serving the last good data: it reads a complete copy in `.mcp-data/` that only a fully successful rebuild replaces. Consumers reading a released registry do not need either. #### Once published (placeholder) > **Placeholder: this does not work yet** > > When `@thedesignproject/tdpxl-mcp` is published, the local path becomes a package run, and the > registry default becomes the hosted one: > > `claude mcp add tdpxl -- npx -y @thedesignproject/tdpxl-mcp` ### AGENTS.md and rules `npx @thedesignproject/tdpxl add guide` (installed with the theme) merges a TDPXL section into your project's `AGENTS.md` and writes `tdpxl/rules.json`. Agents that read `AGENTS.md` (Claude Code, Cursor, Copilot, Codex and others) then know where components live, that they use semantic roles instead of palette classes and `dark:` variants, that Button uses `intent` and `emphasis` rather than `variant`, and that each component's `.meta.json` says when to use it and what is safe to change. The MCP `get_rules` tool returns the same content. ### Check the result After an agent changes the theme or a component, run: ```bash npx @thedesignproject/tdpxl check ``` It recomputes every semantic contrast pair in both themes and flags raw palette classes, `dark:` variants and hex classes. See [Customizing for your brand](https://tdpxl.designproject.io/docs/customizing.md#what-tdpxl-check-does). The MCP `check_theme` tool runs the same contrast math, so an agent can test values before writing them. Automated checks do not replace a keyboard pass, a screen-reader pass or a design review; see [Accessibility](https://tdpxl.designproject.io/docs/accessibility.md). ## Tokens Docs: https://tdpxl.designproject.io/docs/tokens.md > A role scale in two layers. Components name jobs, not colors. This is the centre of the system. Everything else leans on it. ### Two layers **Underneath, raw ramps.** Seven colors, twelve steps each, generated from a shared lightness curve in `oklch`. `gray-500` is a color and nothing more. It means nothing. **On top, roles.** A role points at a step and gives it a job. `text-sub-600` is not "grey 600": it is secondary text. Components may only touch the top layer. That rule is what makes dark mode a reassignment instead of a rewrite. ### Why the names carry numbers The number records how far the role sits from the light end of the scale. It is not decoration, and it earns its place: ``` soft-200 a soft surface, a divider soft-400 soft text, a label ``` They share the adjective because they play a similar part, but they do not share a value, because readable text needs more contrast than a line does. Without the number you would have to invent two different adjectives for the same idea. ### Surfaces ### Text `text-strong-950` for headings, `text-sub-600` for secondary body copy, `text-soft-400` for supporting detail, `text-disabled-300` for anything inactive, `text-white-0` to read on top of a dark fill. ### States, in four steps Six families: `success`, `warning`, `error`, `information`, `away`, `faded`. Each with the same four steps, and each step with a fixed job: | Step | What it is for | | --- | --- | | `lighter` | the background fill | | `light` | the border around that fill | | `base` | the solid color that acts | | `dark` | the text read on top of the fill | `away` and `faded` look out of place beside `error` until you see what they are for: they are presence states. Away and offline. They live here because they behave exactly like the other states, with the same four steps. ### Brand `primary-base`, `primary-dark` and `primary-darker` for the solids. Plus three translucent fills, `primary-alpha-10`, `primary-alpha-16` and `primary-alpha-24`, for hover and focus rings over surfaces the component does not know in advance. ### Dark mode Dark mode redefines no colors. It reassigns which step each role points at: ```ts // light "weak-50": "gray.50" // nearly white "strong-950": "gray.950" // nearly black // dark "weak-50": "gray.900" // nearly black "strong-950": "gray.25" // nearly white ``` The raw ramps never move. That is why `bg-weak-50` still means "the background one notch away from the paper" in both schemes, even though the value is the opposite one. ### Where it all comes from `lib/tokens.ts` is the single source of truth. It defines the ramps, the light role map and the dark one. `scripts/build-tokens.ts` turns that into `app/tokens.css`: the variables under `:root` and `.dark`, plus a `@theme inline` block that teaches Tailwind the `bg-weak-50`, `text-sub-600`, `border-soft-200`, `rounded-10` and `shadow-regular-md` utilities. The same file feeds the registry's `theme` item, so anyone running `npx @thedesignproject/tdpxl add theme` receives exactly the scale this site renders. ```bash pnpm tokens:build ``` Changing the entire palette means editing one TypeScript file and running that command. No component is touched. ### Typography The same reasoning applies to text: `text-title-h1`, `text-label-md`, `text-paragraph-sm`, `text-subheading-xs`. A component picks a typographic role, never a loose size. ## Theming Docs: https://tdpxl.designproject.io/docs/theming.md > Change brand colors, radii, shadows and fonts without touching a component. Components never name a color. They name a **role** — `bg-weak-50`, `text-sub-600`, `border-soft-200`, `bg-primary-base` — and each role is a CSS variable. Theming TDPXL means changing what those variables hold. The role scale itself is explained in [Tokens](https://tdpxl.designproject.io/docs/tokens.md). ### The roles | Family | Roles | Used for | | --- | --- | --- | | Surfaces | `white-0`, `weak-25`, `weak-50`, `soft-200`, `sub-300`, `surface-800`, `strong-950` | Page, raised and sunken surfaces, dividers, inverted fills | | Text | `strong-950`, `sub-600`, `soft-400`, `disabled-300`, `white-0` | Headings, body, supporting detail, inactive text, text on fills | | Brand | `primary-base`, `primary-dark`, `primary-darker`, `primary-alpha-10`, `primary-alpha-16`, `primary-alpha-24` | Primary actions, hover/pressed steps, translucent fills and focus rings | | States | `success-*`, `warning-*`, `error-*`, `information-*`, `away-*`, `faded-*`, `highlight-*` | Each with `lighter` (fill), `light` (border), `base` (solid) and `dark` (text on the fill) | Every role exists in both `:root` (light) and `.dark`, with the same name. ### In your project: edit the CSS variables After `init`, the roles live in your stylesheet, inside the section between `tdpxl:theme:start` and `tdpxl:theme:end`. That section is managed: `npx @thedesignproject/tdpxl update theme` brings in a new registry version, merging edits you made inside it, and `add theme --overwrite` resets it. Put your changes **after the end marker** instead, so an update never has to merge them. A later rule with the same selector wins: ```css /* tdpxl:theme:end */ :root { --primary-base: oklch(0.55 0.2 300); --primary-dark: oklch(0.47 0.18 300); --primary-darker: oklch(0.39 0.15 300); --primary-alpha-10: oklch(0.55 0.2 300 / 10%); --primary-alpha-16: oklch(0.55 0.2 300 / 16%); --primary-alpha-24: oklch(0.55 0.2 300 / 24%); } .dark { --primary-base: oklch(0.72 0.17 300); --primary-dark: oklch(0.8 0.13 300); --primary-darker: oklch(0.87 0.09 300); --primary-alpha-10: oklch(0.72 0.17 300 / 10%); --primary-alpha-16: oklch(0.72 0.17 300 / 16%); --primary-alpha-24: oklch(0.72 0.17 300 / 24%); } ``` Three things to keep in mind: - **Set both schemes.** A role changed only in `:root` keeps its old dark value. - **The alpha roles are literal values.** In the installed CSS, `--primary-alpha-*` are written out, not derived from `--primary-base`. Change them together, or define them with `color-mix(in oklch, var(--primary-base) 16%, transparent)`. - **Check contrast.** `white-0` text sits on `primary-base`, and each state's `dark` text sits on its `lighter` fill. Normal text needs 4.5:1 in both themes. There is no need for `@theme` changes: `@theme inline` already points `--color-primary-base` at `var(--primary-base)`, so every utility follows. ### In the TDPXL repository: edit lib/tokens.ts If you maintain a fork of the registry, the CSS above is generated, and editing it by hand would be lost on the next build. The source of truth is `lib/tokens.ts`: - `RAMPS` — seven raw `oklch` ramps (`gray`, `blue`, `green`, `orange`, `yellow`, `red`, `purple`), twelve steps each, built from one lightness curve. - `SEMANTIC_LIGHT` and `SEMANTIC_DARK` — each role pointing at a ramp step, such as `"primary-base": "blue.700"`, or at a literal value. - `primary-alpha-10/16/24` are derived from `primary-base` at build time. - `RADII` and `SHADOWS` — see below. ```bash pnpm tokens:build # app/tokens.css for the site and Storybook pnpm registry:build # the theme item consumers install ``` Changing the brand hue is one edit to the `blue` ramp, or to the brand roles' references. No component changes. ### Radii | Utility | Value | | --- | --- | | `rounded-4` | 0.25rem | | `rounded-6` | 0.375rem | | `rounded-8` | 0.5rem | | `rounded-10` | 0.625rem | | `rounded-12` | 0.75rem | | `rounded-16` | 1rem | | `rounded-20` | 1.25rem | | `rounded-full` | 9999px | They are `--radius-*` variables inside `@theme inline`. To make the whole system rounder or squarer, override them in your own `@theme` block after the managed section, for example `@theme { --radius-10: 0.75rem; }`. ### Shadows `shadow-regular-xs`, `shadow-regular-sm`, `shadow-regular-md` and `shadow-regular-lg` for elevation; `shadow-button-primary-focus` and `shadow-button-error-focus` for focus rings; `shadow-toggle-switch` for the switch thumb. The focus shadows reference `--white-0`, `--primary-alpha-24` and `--error-base`, so they follow your colors and the dark scheme. ### Typography Components pick a typographic role, never a loose size. The theme adds these utilities with `@utility`: | Utility | Size / line height | Weight | | --- | --- | --- | | `text-title-h1` | 3.5rem / 1 | 500 | | `text-title-h4` | 2rem / 1.15 | 500 | | `text-label-lg` | 1.125rem / 1.5rem | 500 | | `text-label-md` | 1rem / 1.5rem | 500 | | `text-label-sm` | 0.875rem / 1.25rem | 500 | | `text-label-xs` | 0.75rem / 1rem | 500 | | `text-paragraph-lg` | 1.125rem / 1.75rem | — | | `text-paragraph-md` | 1rem / 1.5rem | — | | `text-paragraph-sm` | 0.875rem / 1.25rem | — | | `text-subheading-xs` | 0.75rem / 1rem, uppercase | 500 | The `cn()` helper installed as `utils` teaches `tailwind-merge` that these are font sizes, so `cn("text-label-sm", "text-sub-600")` keeps both classes. ### Fonts The theme's base styles set `font-family: var(--font-sans)` on `body`, but the theme **does not define `--font-sans`**. That is deliberate: the font is your brand decision and loading it is your framework's job. Until you set it, the value comes from Tailwind's default theme, a system font stack. To use your own font, define the variable in your `@theme`. With `next/font`: ```tsx // app/layout.tsx import { Inter } from "next/font/google" const inter = Inter({ subsets: ["latin"], variable: "--font-inter" }) export default function RootLayout({ children }: { children: React.ReactNode }) { return ( {children} ) } ``` ```css /* app/globals.css, outside the managed section */ @theme inline { --font-sans: var(--font-inter), ui-sans-serif, system-ui, sans-serif; } ``` In Vite, load the font with `@font-face` or a package such as Fontsource and set `--font-sans` the same way. ## Dark mode Docs: https://tdpxl.designproject.io/docs/dark-mode.md > A .dark class on an ancestor switches every role. Set it with next-themes or a few lines of script. ### How it works The theme writes every role twice: once under `:root` and once under `.dark`. When an ancestor — normally `` — has the `dark` class, the same variable names resolve to their dark values: ```css :root { --weak-50: oklch(0.975 0.0022 264); /* nearly white */ } .dark { --weak-50: oklch(0.283 0.0121 264); /* nearly black */ } ``` `bg-weak-50` reads `var(--weak-50)`, so it follows. That is all dark mode is. ### Why components have no dark: classes Because nothing in a component needs to change. A component says `text-sub-600` ("secondary text"); dark mode decides which color secondary text is. Writing `dark:text-gray-400` next to it would duplicate that decision in every file, and the two would drift. TDPXL's source has no `dark:` variants at all, and its rules forbid them. The CLI still adds `@custom-variant dark (&:is(.dark *));` to your stylesheet, so the `dark:` variant follows the same class in your own code if you need it. ### Next.js with next-themes ```bash npm install next-themes ``` ```tsx // app/layout.tsx import { ThemeProvider } from "next-themes" export default function RootLayout({ children }: { children: React.ReactNode }) { return ( {children} ) } ``` `attribute="class"` is the important part: it toggles `dark` on ``. `suppressHydrationWarning` is needed because next-themes sets that class before React hydrates. Switch themes with the hook: ```tsx "use client" import { useTheme } from "next-themes" import { Button } from "@/components/ui/button" export function ThemeToggle() { const { resolvedTheme, setTheme } = useTheme() const next = resolvedTheme === "dark" ? "light" : "dark" return ( ) } ``` ### Vite with a class toggle Without a framework provider, set the class yourself. Run this inline script in `index.html`, before your app loads, so the first paint already has the right colors: ```html ``` And toggle it from React: ```tsx import { Button } from "@/components/ui/button" export function ThemeToggle() { function toggle() { const dark = document.documentElement.classList.toggle("dark") localStorage.setItem("theme", dark ? "dark" : "light") } return ( ) } ``` ### Toasts The [Sonner](https://tdpxl.designproject.io/docs/components/sonner.md) `Toaster` reads its theme from `next-themes`. A `.dark` class alone does not configure it: inside next-themes' `ThemeProvider` it follows the theme automatically, and anywhere else pass `theme="light"` or `theme="dark"` to `Toaster` yourself. ### Checking both schemes Contrast is tested per scheme. If you change a role, check it in both — see [Theming](https://tdpxl.designproject.io/docs/theming.md) and [Accessibility](https://tdpxl.designproject.io/docs/accessibility.md). ## Customizing for your brand Docs: https://tdpxl.designproject.io/docs/customizing.md > Change colors, type and components safely, with checks and AI guidance that come with every install. TDPXL is a base. Once installed, the components are your code: change the brand, the copy and even the behavior. What TDPXL ships alongside each component helps you keep it usable and accessible while you do. ### What every install brings When you run `npx @thedesignproject/tdpxl init` or `add`, besides the component itself you get: | File | What it is for | | --- | --- | | `components/ui/.meta.json` | Usage guidance for the component: when to use it, its parts, keyboard/pointer/touch behavior, responsive behavior, content guidelines, and what is **safe to change** versus what to **re-check after changing**. Yours to edit. | | `tdpxl/rules.json` | The rules `tdpxl check` uses: semantic contrast pairs for both themes and style rules. | | `AGENTS.md` (managed section) | Instructions for coding agents (Claude, Cursor, Copilot and others that read `AGENTS.md`): where things are, conventions, and to run `tdpxl check` after changes. Only the section between the `tdpxl:agents` markers is managed; the rest of the file is yours. Skip it with `--skip-agents`. | ### Change the brand 1. Keep the managed theme section as it is (between `tdpxl:theme:start` and `tdpxl:theme:end`). `tdpxl update theme` refreshes it (merging any edits made inside it); overrides after the end marker never need merging. 2. Add your own blocks **after** it and override role values: ```css /* after tdpxl:theme:end */ :root { --primary-base: oklch(0.55 0.2 30); } .dark { --primary-base: oklch(0.75 0.16 30); } ``` 3. Run the check: ```bash npx @thedesignproject/tdpxl check ``` ### What `tdpxl check` does - **Contrast:** recomputes every semantic pair in both themes from your actual CSS (hex, rgb, hsl and oklch; alpha is composited over the surface): text pairs at 4.5:1, focus outlines and control boundaries at 3:1. - **Suggestions:** for a brand role that fails, it proposes the nearest value with the **same hue and chroma** that passes every pair the role takes part in. - **Style rules:** flags raw palette classes (`bg-blue-500`), `dark:` variants and hex classes in installed components; dark mode works by remapping roles. - Exits with code 1 on failure, so it can run in CI. `--json` prints a machine-readable report for tools and agents. `check contrast` or `check rules` runs one group. ```text Contrast · light 27/33 pairs pass ✖ primary-base on white-0 (text): 1.41:1, needs 4.5:1 ✖ white-0 on primary-base (text): 1.41:1, needs 4.5:1 Suggested values (same hue and chroma, nearest lightness that passes every pair) :root { --primary-base: oklch(0.502 0.182 99.8); } was #f5d90a ``` ### Try values before changing anything Storybook includes **TDPXL / Customize / Theme check**: type brand values, see every pair pass or fail live in the current theme, preview real components with your values, apply the suggested value and copy the CSS for your project. It uses the same pairs and math as `tdpxl check`. ### Change a component 1. Open its `.meta.json`. `customization.safe` lists what you can change freely; `customization.verify` pairs each kind of change with the check to run afterwards (for example: changing a size → keep a 24×24 target). 2. Edit the component. 3. Run `npx @thedesignproject/tdpxl check`. 4. If you changed behavior or the API, update the `.meta.json` so your team and its AI tools keep accurate guidance. It is your copy: adapt the wording, add your own rules, remove what does not apply. ### What automation does not cover Checks compute contrast and scan code; they do not replace a keyboard pass, a screen-reader pass (VoiceOver, NVDA), or a design review. ## Migrating from shadcn/ui or Radix Colors Docs: https://tdpxl.designproject.io/docs/migrating.md > Keep your old components while you move to TDPXL, on one theme instead of two. A migration rarely happens in one go. For weeks, a project runs its old components next to new TDPXL ones. Without help, it also runs two themes: the old system's variables and TDPXL's roles. Every brand color and every dark-mode fix then has to be made twice, and the two halves of the app drift apart. A **bridge** removes the second theme. It defines the variable names your old components read, and points each one at a TDPXL role. TDPXL becomes the only theme; the old components follow it, in light and dark, until you delete them. | Bridge | Install | Answers | | --- | --- | --- | | shadcn/ui | `npx @thedesignproject/tdpxl add bridge-shadcn` | `--background`, `--foreground`, `--card`, `--popover`, `--primary`, `--secondary`, `--muted`, `--accent`, `--destructive` (each with `-foreground`), `--border`, `--input`, `--ring`, `--radius`, the `--sidebar-*` set, and the Tailwind utilities that use them (`bg-background`, `rounded-md` …) | | Radix Colors | `npx @thedesignproject/tdpxl add bridge-radix-colors` | `--{scale}-1` … `--{scale}-12` for `gray`, `slate`, `blue`, `green`, `orange`, `yellow`, `amber`, `red` and `purple`, light and dark | The shadcn/ui bridge contains no colors, only `var()` references to TDPXL roles, so it cannot drift from the theme and dark mode needs nothing extra. Radix Colors names hues rather than roles, so its bridge carries TDPXL's ramp colors itself (see [below](#how-radix-colors-steps-map)). A dark section inside a light page (`
`) works for inline components. Menus, dialogs and popovers render in a portal at the end of ``, outside that section, so they follow the page's theme, not the section's. That is true of TDPXL's own components too. ### Set it up 1. Run `npx @thedesignproject/tdpxl init` if the project does not have TDPXL yet. 2. Add the bridge. It is written to `tdpxl/bridges/.css`. 3. Import it in your stylesheet **after** the TDPXL theme section: ```css @import "tailwindcss"; /* tdpxl:theme:start … tdpxl:theme:end */ @import "../tdpxl/bridges/shadcn.css"; ``` 4. Delete the old system's color variables (for shadcn/ui, the `:root`, `.dark` and `@theme inline` color blocks in your `globals.css`). If you keep them, whichever rule comes last wins, and you are back to two themes. 5. Run `npx @thedesignproject/tdpxl check` to confirm the TDPXL theme still passes contrast. From here, change colors only in the TDPXL theme, as described in [Theming](https://tdpxl.designproject.io/docs/theming.md). Old and new components both follow. ### How shadcn/ui names map Each name points at the role TDPXL's own components use for the same job. | shadcn/ui | TDPXL role | | --- | --- | | `background`, `card`, `popover` | `white-0` | | `foreground` and the `-foreground` of neutral surfaces | `strong-950` | | `primary`, `ring`, `sidebar-primary`, `sidebar-ring` | `primary-base` | | `primary-foreground`, `destructive-foreground`, `sidebar-primary-foreground` | `white-0` | | `secondary`, `muted`, `accent`, `sidebar` | `weak-50` | | `muted-foreground` | `sub-600` | | `destructive` | `error-base` | | `border`, `input`, `sidebar-border`, `sidebar-accent` | `soft-200` | | `radius` | `radius-10` (0.625rem) | | `chart-1` … `chart-5` | Already TDPXL roles with the same names | The mapping is a starting point, not a rule. To send one name elsewhere, override it after the bridge import, for example `:root { --accent: var(--primary-alpha-10); }`. ### How Radix Colors steps map Radix gives each step a job: 1–2 backgrounds, 3–5 component fills, 6–8 borders, 9–10 solid fills, 11–12 text. In light, steps 1–12 follow TDPXL's ramp in order (`25` … `950`), so step 9 is the `700` that TDPXL's `*-base` roles use. In dark, Radix keeps step 9 a saturated solid, so it lands on TDPXL's `500`, and 11–12 are the light steps TDPXL's dark text roles use. Dark has fewer ramp steps to spend, so a few steps are midpoints between two TDPXL steps; every step stays distinct, so hover and pressed fills (3 → 4 → 5) still show. The TDPXL theme installs roles, not ramps, so this bridge writes the ramp colors itself. They do not follow a TDPXL rebrand: move a component to TDPXL roles when it should. It switches with `.light`/`.light-theme` and `.dark`/`.dark-theme`, so nested sections of either scheme work. `slate` and `amber` map to TDPXL's `gray` and `yellow`. Other Radix hues, the alpha scales (`--blue-a1` …) and the P3 variants are not bridged: TDPXL has no ramp to answer them. Keep those from Radix for now, or move those components to TDPXL roles first. ### When you are done Once no component reads the old names, remove the import and run `npx @thedesignproject/tdpxl remove bridge-shadcn` (or `bridge-radix-colors`). ## Accessibility Docs: https://tdpxl.designproject.io/docs/accessibility.md > What is tested, what is not, the one open finding, and what stays your responsibility. TDPXL builds interactive behavior on Radix UI, cmdk, Vaul, Embla, React DayPicker and native elements, and tests it. Testing is evidence, not a certification: this page says what the evidence covers and where it stops. ### What is tested - **Interaction tests.** Every one of the 71 components has a behavior contract (`governance/contracts.json`) naming the states it must support, and Storybook stories with `play` functions that exercise them: keyboard operation, focus movement and return, disabled and invalid states, controlled and uncontrolled use. Each component page lists those states under *Behavior and accessibility*. - **Automated audit.** The same stories run through axe (Storybook's a11y addon) as a blocking check, in Vitest browser mode with headless **Chromium**, once in the **light** and once in the **dark** theme, with reduced motion requested. - **Focused scripted checks** for the riskier families — overlays, menus, the sidebar, split panes, the message scroller, notifications, navigation and native actions — at 320, 390, 768 and 1440 CSS px in both themes: actual focus containment and return, scrolling, reflow and clipping. - **Contrast.** Representative semantic pairs (`governance/contrast-pairs.json`) are measured in both themes against a 4.5:1 minimum for text. At the last recorded checkpoint (2026-11-09) the full suite ran 2,152 interaction checks, all passing, and 2,152 audit checks with 2,144 passing and 8 failing. All 8 failures are the same NavigationMenu finding. ### The open finding: NavigationMenu When NavigationMenu is open, axe reports `aria-hidden-focus` in both themes. The upstream Radix primitive renders an `aria-hidden` element that can take focus and immediately redirects it into the visible content. Keyboard routing works in the browser tests, but the audit failure stands: TDPXL has not patched around the upstream mechanism, excluded the rule or waived it, and the component is **not accessibility-approved**. If you use it, review it with the assistive technology your users rely on. ### What is not tested - **Screen readers.** No component has completed manual screen-reader review yet. Component pages only show a status once a review is done; until then, assume it is pending. Browser accessibility-tree checks are not a substitute for VoiceOver, NVDA or JAWS. - **Other browsers.** The suites run in Chromium only. - **Your composition.** Tests cover the official examples. A new combination, new copy, new colors or a different layout needs its own check. - **Design quality.** Passing geometry and contrast checks does not approve a visual design. ### Your responsibilities The components keep their semantics; some decisions can only be made where they are used. - **Names.** Give icon-only buttons an `aria-label`. Associate every label, hint and error with its control: a [Field](https://tdpxl.designproject.io/docs/components/field.md) needs explicit ids and either a hint or an error. - **Dialogs.** Every [Dialog](https://tdpxl.designproject.io/docs/components/dialog.md) needs a title and a description. Closing a dialog does not save anything. - **Charts.** A chart is not a text alternative. Provide the same data as a table, a summary or a download next to every [Chart](https://tdpxl.designproject.io/docs/components/chart.md). - **Hover cards.** [Hover card](https://tdpxl.designproject.io/docs/components/hover-card.md) content is supplemental. It opens on hover or focus and is not a keyboard-operated dialog, so required information and actions must also exist elsewhere. Give its anchor trigger an `href`. - **Toasts.** Showing a [Sonner](https://tdpxl.designproject.io/docs/components/sonner.md) toast does not move focus. Anything important also needs a durable place in the page. - **Navigation.** [Pagination](https://tdpxl.designproject.io/docs/components/pagination.md) marks the page you say is current; routing, totals and boundaries are yours, and `aria-disabled` does not stop an anchor from navigating. Keep enough space around small [Breadcrumb](https://tdpxl.designproject.io/docs/components/breadcrumb.md) links to meet target-size requirements. - **Identity and status.** [Avatar](https://tdpxl.designproject.io/docs/components/avatar.md) fallbacks need meaningful text, and status or category must be stated in text, never by color alone (for example in a [Badge](https://tdpxl.designproject.io/docs/components/badge.md)). - **Programmatic changes.** If code collapses a [Resizable](https://tdpxl.designproject.io/docs/components/resizable.md) panel or closes a disclosure while focus is inside it, move focus somewhere sensible. - **Customization.** When you change colors, sizes or motion, keep 4.5:1 text contrast in both themes, a visible focus indicator, reflow down to 320px and the reduced-motion behavior the components ship with. Each component page lists the accessibility requirements that apply to it. ## Using components Docs: https://tdpxl.designproject.io/docs/using-components.md > How to find the right component, install it, read its page and make it yours. The [gallery](https://tdpxl.designproject.io/components) is where you browse what TDPXL has. These docs explain how to work with what you find there. ### Find the right one Start from what the user needs to do, not from a component name. Each component page in the gallery has an **Accessibility & usage** section with *When to use*, *When not to use* and *Alternatives*. Read those before you pick: two components that look alike often differ in what they announce to a screen reader or how the keyboard moves through them. - [Components](https://tdpxl.designproject.io/components): the building blocks, grouped by job (primitives, forms, overlays, navigation, feedback, data and chat). - [Charts](https://tdpxl.designproject.io/charts): chart families, each with its variants. - [Blocks](https://tdpxl.designproject.io/blocks): complete sections and pages (login, dashboard, settings) composed from components. - [Hooks](#hooks): small React hooks some components depend on. ### Read a component page Every component page in the gallery follows the same order: 1. **Installation**: the command and the files it writes. 2. **Examples**: each example in its own frame, with the code as you would write it. 3. **API reference**: props generated from the TypeScript source, with the inherited DOM props listed separately. 4. **Accessibility & usage**: when to use it, its parts, keyboard and interaction, responsive behavior and content guidelines. ### Install ```bash npx @thedesignproject/tdpxl add button npx @thedesignproject/tdpxl add dialog field input ``` `add` copies the source into your project, plus any other TDPXL items and npm packages it imports. Run [`init`](https://tdpxl.designproject.io/docs/cli.md#init) once first. Files land where `tdpxl.json` says (by default `components/ui/`); see [CLI](https://tdpxl.designproject.io/docs/cli.md) for every flag. ### Make it yours The installed file is plain code in your repository. Change it like any other file. - **Brand and color**: change the role tokens, not the component. A component writes `bg-primary-base`, so changing `--primary-base` restyles all of them. See [Theming](https://tdpxl.designproject.io/docs/theming.md) and [Customizing](https://tdpxl.designproject.io/docs/customizing.md). - **Variants**: components describe intent and emphasis instead of a single `variant`. A Button takes `intent`, `emphasis` and `size`; add your own option to the component's variant list when the existing ones do not fit. - **Structure**: most components are composed from parts (`Dialog`, `DialogContent`, `DialogTitle`...). Leave out the parts you do not need instead of hiding them with CSS. - **Check after changing**: `npx @thedesignproject/tdpxl check` re-checks contrast in both themes and flags raw palette classes, hex values and `dark:` variants. ### Keep up to date Copied code does not update itself. When the registry changes: ```bash npx @thedesignproject/tdpxl diff npx @thedesignproject/tdpxl update button ``` `diff` shows what changed upstream and what you changed locally. `update` merges both and stops on a conflict instead of overwriting your edits. Details are in [Staying up to date](https://tdpxl.designproject.io/docs/cli.md#staying-up-to-date). ### Charts and blocks **Charts** are built on Recharts and color their series with the chart roles, so they follow your theme. Every chart needs a text alternative next to it (a table, a summary or a download); see [Accessibility](https://tdpxl.designproject.io/docs/accessibility.md). **Blocks** are starting points, not dependencies. `add` writes a block's files into your app, often as a route (`app/login/page.tsx`). After that they are your pages: rename, split and rewrite them freely. Some blocks import `next/link` and only compile in Next.js; see [Installation](https://tdpxl.designproject.io/docs/installation.md). ### Hooks Hooks install into `hooks/` (the `hooks` alias in `tdpxl.json`). Components that need one install it for you. | Hook | What it does | Install | | --- | --- | --- | | `use-mobile` | Whether the viewport is below the mobile breakpoint, resolved after mount so the server never guesses. Exports `useIsMobile`. | `npx @thedesignproject/tdpxl add use-mobile` | | `use-inert-background` | Pairs Radix modal background hiding with native `inert`, restoring the previous state on close. Exports `useInertBackground`. | `npx @thedesignproject/tdpxl add use-inert-background` | ### With an AI agent Each installed component comes with a `.meta.json` next to it: the same usage guidance as the gallery, in a form a coding agent reads. Ask your agent to read it before changing the component, and to run `npx @thedesignproject/tdpxl check` afterwards. See [AI agents](https://tdpxl.designproject.io/docs/ai.md). ## Registry Docs: https://tdpxl.designproject.io/docs/registry.md > How items are built from source, what an item contains, and how to host your own registry. A TDPXL registry is a folder of static JSON files: one document per item plus a `registry.json` index. The CLI fetches them over HTTP or reads them from disk. There is no server logic, so any static host works. ### From source to JSON 1. **The catalogues** — `lib/components.ts`, `lib/hooks.ts`, `lib/charts.ts` and `lib/blocks.ts`. A name, title and description for every item, a group or category, and for blocks the route the page lands on. No dependency lists. 2. **`scripts/build-registry.ts`** — reads each item's source files, works out their dependencies from their imports, inlines the source, and writes `public/r/.json` and `public/r/registry.json`. 3. **`public/r/`** — the output, served as it is. ```bash pnpm registry:build ``` ### Dependencies are derived from imports Nobody writes a dependency list by hand. The build reads every `import`, `export … from`, side-effect import and dynamic `import()` in the file: | Import | Becomes | | --- | --- | | `@/registry/ui/`, `@/registry/hooks/`, `@/registry/charts/` | `registryDependencies: [""]` | | `@/lib/utils` | `registryDependencies: ["utils"]` | | A package, such as `radix-ui` or `lucide-react` | `dependencies` (React, React DOM and Next.js are never listed) | | Any other `@/…` path | A build error: the installed file would not compile | Every component also depends on `theme`, because every component reads the role scale. The build fails if an item depends on a name that is not in the registry, so a broken graph never reaches the machine of whoever installs it. A hand-kept list goes stale the first time someone adds an import, and the failure then shows up as a missing module in someone else's project. Deriving it means the list cannot disagree with the code. ### Item types | Type | Source | Installed as | | --- | --- | --- | | `registry:ui` | `registry/ui/.tsx` | `components/ui/.tsx` | | `registry:hook` | `registry/hooks/.ts` | `hooks/.ts` | | `registry:block` | `registry/charts/.tsx` | `components/.tsx` | | `registry:block` | `registry/blocks//**` | `app//page.tsx` plus its components beside it | | `registry:lib` | `registry/lib/utils.ts` (`utils`) | `lib/utils.ts` | | `registry:theme` | `lib/tokens.ts`, `lib/styles.ts` (`theme`) | A managed section of your stylesheet | Inside a block, the page has the file type `registry:page` and the other files `registry:component`; each carries a `target` under `app//` that keeps their relative positions. Destinations are the defaults; the aliases in `tdpxl.json` decide the real folders. See [CLI](https://tdpxl.designproject.io/docs/cli.md#where-files-land). ### What an item looks like TDPXL items follow TDPXL's own item schema, referenced by `$schema` and served next to the registry under `/schema/`. ```json { "$schema": ".../schema/registry-item.json", "name": "combobox", "type": "registry:ui", "version": "0.1.0", "title": "Combobox", "description": "A searchable select, composed from Popover and Command.", "categories": ["forms"], "dependencies": ["cmdk", "lucide-react"], "registryDependencies": ["button", "command", "popover", "theme", "utils"], "files": [ { "path": "registry/ui/combobox.tsx", "type": "registry:ui", "content": "\"use client\"\n\nimport ...", "hash": "sha256:…" } ] } ``` | Field | Meaning | | --- | --- | | `name` | Lowercase, hyphenated; what you pass to `add` | | `type` | One of the item types above | | `version` | Semver of the item; see [Versions](#versions) | | `title`, `description`, `categories` | Catalogue data shown by `list` and the site | | `dependencies`, `devDependencies` | npm packages the source imports | | `registryDependencies` | Bare names of other items in the same registry | | `files[]` | `path` in the registry, file `type`, optional `target`, the full `content`, and `hash` (sha256 of `content`) | | `cssVars` | Only on `theme`: `light` and `dark` role values, and `theme` radius/shadow tokens | | `css` | Only on `theme`: imports, base styles and `@utility` rules | | `cssHash` | Only on `theme`: sha256 of `JSON.stringify({ cssVars, css })` | `registryDependencies` are bare names because they always mean "the item with this name in the registry you are installing from". The same JSON works on a production host, a staging host or a local folder without being rebuilt. `registry.json` lists every item with the same fields minus file contents and CSS, and is what `npx @thedesignproject/tdpxl list` reads. ### The theme item `theme` carries no files, only variables and CSS, generated from `lib/tokens.ts` and `lib/styles.ts` at build time. That keeps the scale a consumer installs identical to the one the site and Storybook render. See [Installation](https://tdpxl.designproject.io/docs/installation.md#what-changes-in-your-css) for what it writes. ### Versions `governance/registry-versions.json` is the source of truth: for each item, its version and the fingerprint (hash of the published item) that version stands for. The build copies the version into every item and adds the content hashes; it warns when an item changed since its recorded version. Versions only move with a local command, which publishes nothing: ```bash pnpm release:version --dry-run # print the plan pnpm release:version # bump, write changelogs, rebuild public/r ``` Describe changes with a changeset file in `.changeset/` (any name, `.md`): ```md --- button: minor --- Button gains a `loading` state. ``` The script applies the largest bump declared per item, gives a patch bump to any item whose content changed without a changeset (so one version never stands for two contents), starts new items at 0.1.0, appends an entry to `governance/changelog/.md` and deletes the consumed changesets. Commit the result together with `public/r`. Consumers compare per-file hashes as well as versions, so `tdpxl diff` also sees content published between two releases. Only the current version of each item is served; `tdpxl update` merges against the copy of the installed version that the consumer keeps in `.tdpxl/base/`, not against old registry documents. ### Hosting your own registry To publish a modified TDPXL — your brand, your components — fork the repository and build it yourself: 1. Change `lib/tokens.ts` for colors, and `registry/` for components. Add new items to the catalogue in `lib/` and give each component a demo. 2. Build, with the public URL the registry will live at: ```bash REGISTRY_HOMEPAGE=https://registry.example.com pnpm registry:build ``` `REGISTRY_HOMEPAGE` is used for the `$schema` and `homepage` fields. 3. Deploy `public/r/` to any static host so that `https://registry.example.com/r/button.json` resolves. 4. Point projects at it, either per project or from the start: ```bash npx @thedesignproject/tdpxl init --registry https://registry.example.com/r TDPXL_REGISTRY=https://registry.example.com/r npx @thedesignproject/tdpxl init ``` or by editing `registry` in an existing `tdpxl.json`. Before deploying, install from the built folder directly: ```bash npx @thedesignproject/tdpxl add button --registry /path/to/your-fork/public/r --dry-run ``` # Docs: https://tdpxl.designproject.io/docs/structure.md --- title: Project structure description: Four layers, and the build order that keeps them honest. --- The site renders this same information, with a tab per layer, at [/structure](https://tdpxl.designproject.io/structure). This page is the short version. ### The four layers **Design system.** `lib/tokens.ts` is the source of truth for color. `scripts/build-tokens.ts` turns it into `app/tokens.css`. Nothing else decides a color. **Registry.** `lib/components.ts` is the catalogue. `scripts/build-registry.ts` derives dependencies from real imports and writes `public/r/*.json`. `registry/` holds everything that ships to other projects. **Routes.** `app/(main)` is the public site, `app/(dashboard)` is the application shell, `app/docs` is this documentation. Route groups in parentheses do not appear in the URL, so two layouts share one URL space with no prefix. **Content and site.** `components/` is the site's own furniture and is never published. `content/docs` is MDX that renders the real components. ### Build order ```bash pnpm build # 1. tokens:build lib/tokens.ts -> app/tokens.css # 2. registry:build lib/components.ts -> public/r/*.json # 3. next build app/** content/** -> .next ``` The order is the point: each step reads what the previous one wrote. Running `next build` alone would compile against whatever tokens and registry happened to be on disk. ### One rule A component may only name a role, never a color. That single constraint is why there is no `dark:` class anywhere in `registry/ui/`, why changing the palette touches one file, and why a block is a composition rather than new code. # Components ## Components Docs: https://tdpxl.designproject.io/docs/components/index.md All 71 components, grouped the way the catalogue groups them. ## Button Docs: https://tdpxl.designproject.io/docs/components/button.md Install: `npx @thedesignproject/tdpxl add button` Purpose: Trigger an action, or style a real link as one, with a clear hierarchy between the main action and the rest. ### API Source-derived. Parts also accept the standard DOM props their element allows (className, ref, aria-*, event handlers). - `Button`: Trigger an action with native button semantics, or style a navigation link through asChild and one anchor. Choose intent for meaning and emphasis for visual weight. Give icon-only actions an accessible name. Set type="button" for non-submit actions inside forms; native buttons otherwise default to submit. - `intent`: `"primary" | "neutral" | "error" | null` (default "primary"). Semantic purpose: primary action, neutral action, or destructive/error action. Independent of visual emphasis. Defaults to primary. - `emphasis`: `"link" | "filled" | "stroke" | "lighter" | "ghost" | null` (default "filled"). Visual weight: filled, stroke, lighter, ghost, or link (text only, underlined on hover). Does not change the action's semantics; use asChild with an anchor when it navigates. Defaults to filled. - `size`: `"xs" | "sm" | "md" | "lg" | null` (default "md"). Control size: xs, sm, md, or lg. Keep labels and icons readable when choosing a size. Defaults to md. - `asChild`: `boolean` (default false). Merge styles and behavior into one child element instead of rendering a button. Use a real anchor with href for navigation; native disabled does not disable an anchor. Defaults to false. - `iconOnly`: `boolean` (default false). Square button for a single icon at the selected size. Always provide aria-label (or aria-labelledby) because there is no visible text. Defaults to false. - `loading`: `boolean` (default false). Show a spinner while an operation runs. The button keeps its width and focus, exposes aria-busy and aria-disabled, and ignores activation until loading ends; with asChild the spinner renders inside the child and its onClick and navigation are blocked. Defaults to false. - Native/primitive props: `disabled`, `form`, `name`, `type`, `value` ### Use when - Submit a form, start an operation, or open an overlay such as a dialog, sheet or menu. - Navigate with button styling by passing asChild and a single real anchor (or router Link) as the child, so the element stays a link. - Show the state of an in-flight action with loading: the button keeps its width and focus and ignores repeated activation. - Use iconOnly for a compact, square action in toolbars or table rows, always with an accessible name. ### Do not use when - An on/off setting that applies immediately; that is a state, not an action. - A pressed formatting option such as bold or italic, or a set of mutually exclusive views. - Plain text navigation inside a paragraph, where a text link reads better and keeps the reading flow. ### Alternatives - `switch`: An immediate on/off setting with a persistent state. - `toggle`: A pressed state for a single formatting or view option. - `toggle-group`: A set of related pressed options, single or multiple. - `dropdown-menu`: Several secondary actions behind one trigger instead of a row of buttons. ### Avoid - More than one filled primary button in the same view region; hierarchy disappears and users hesitate. - An icon-only button without aria-label or aria-labelledby. - A native button that navigates with onClick instead of a real link (no open-in-new-tab, no URL preview, wrong semantics). - Disabling a button to show progress: focus is lost and screen readers stop announcing it. Use loading instead. - A button inside a form without an explicit type, which submits the form by accident. - Labels that describe the control instead of the outcome, such as 'Click here' or 'Submit' when 'Save changes' is meant. ### Accessibility contract - Enter and Space activate a native button; a link rendered through asChild activates with Enter only, like any link. - Focus is shown with a visible outline on keyboard focus only (focus-visible); pointer clicks do not leave a ring. - While loading the button stays focusable, sets aria-busy and aria-disabled, and swallows clicks and submissions until loading ends. - Disabled buttons are skipped by Tab and ignore pointer input; prefer explaining why an action is unavailable next to it. - Hover and pressed feedback come from emphasis, never from color alone; the label never changes on hover. - text-contrast: Normal text and placeholders meet 4.5:1; large text meets 3:1. Check actual backgrounds in both themes and relevant hover/focus/selected/invalid states. Disabled exceptions do not apply to enabled outside-calendar days. - reflow: Preserve content and actions at 320, 390, 768 and 1440 CSS px. Contain intentional two-dimensional scrolling. Review 200% text enlargement and actual browser zoom separately. - state-meaning: Convey meaningful status or selection through semantics and text/shape as appropriate, not color alone. Do not make passive parts focusable merely to fill a state matrix. - keyboard-focus: Every operable control has a visible focus indicator and logical keyboard use. Keep focus reachable and unobscured. Review indicator contrast against adjacent surfaces. - accessible-name: Actions and inputs have contextual accessible names. Icon-only controls need a name; repeated navigation landmarks need distinguishable names. Visible label text remains in the accessible name. - reduced-motion: Respect reduced-motion preference in delivered code. Keep state and interaction understandable. Storybook animation overrides do not prove production behavior. Human review: design pending, screenReader pending. ### Examples #### Primary ```tsx "use client" import { Button } from "@/components/ui/button" export function ButtonPrimary() { return (
) } ``` #### Stroke ```tsx "use client" import { Button } from "@/components/ui/button" export function ButtonStroke() { return (
) } ``` #### Lighter ```tsx "use client" import { Button } from "@/components/ui/button" export function ButtonLighter() { return (
) } ``` #### Ghost ```tsx "use client" import { Button } from "@/components/ui/button" export function ButtonGhost() { return (
) } ``` #### Neutral ```tsx "use client" import { Button } from "@/components/ui/button" export function ButtonNeutral() { return (
) } ``` #### Error ```tsx "use client" import { Button } from "@/components/ui/button" export function ButtonError() { return (
) } ``` #### Error stroke ```tsx "use client" import { Button } from "@/components/ui/button" export function ButtonErrorStroke() { return (
) } ``` #### Sizes ```tsx "use client" import { Button } from "@/components/ui/button" export function ButtonSizes() { return (
) } ``` #### With icon ```tsx "use client" import { PlusIcon } from "lucide-react" import { Button } from "@/components/ui/button" export function ButtonWithIcon() { return (
) } ``` #### Trailing icon ```tsx "use client" import { ArrowRightIcon } from "lucide-react" import { Button } from "@/components/ui/button" export function ButtonTrailingIcon() { return (
) } ``` #### Link emphasis ```tsx "use client" import { Button } from "@/components/ui/button" export function ButtonLinkEmphasis() { return (
) } ``` #### Anchor actions ```tsx "use client" import { ArrowRightIcon, ExternalLinkIcon } from "lucide-react" import { Button } from "@/components/ui/button" export function ButtonAnchorActions() { return ( ) } ``` #### Disabled emphases ```tsx "use client" import { SettingsIcon } from "lucide-react" import { Button } from "@/components/ui/button" export function ButtonDisabledEmphases() { return (
) } ``` #### Loading emphases ```tsx "use client" import { Trash2Icon } from "lucide-react" import { Button } from "@/components/ui/button" export function ButtonLoadingEmphases() { return (
) } ``` #### Icon only sizes ```tsx "use client" import { PlusIcon } from "lucide-react" import { Button } from "@/components/ui/button" export function ButtonIconOnlySizes() { return (
) } ``` ## Button group Docs: https://tdpxl.designproject.io/docs/components/button-group.md Install: `npx @thedesignproject/tdpxl add button-group` Purpose: Join closely related buttons into one visual unit with shared borders, while each button keeps its own semantics and behavior. ### API Source-derived. Parts also accept the standard DOM props their element allows (className, ref, aria-*, event handlers). - `ButtonGroup`: Joins adjacent buttons into one control. The children keep their own variants; only the corners and the shared border are managed here. - `orientation`: `"horizontal" | "vertical"` (default "horizontal"). Horizontal or vertical layout. The consuming layout must provide enough space for the selected orientation. - `ButtonGroupSeparator`: Visual or semantic separation between adjacent items. It is not an operable item. ### Use when - A small set of actions that operate on the same object, such as Previous and Next, or zoom out, reset and zoom in. - A split button: a main action joined to an icon-only trigger that opens a dropdown menu of related variants. - A row of icon-only tool actions that read as one cluster in a dense toolbar or editor header. ### Do not use when - Choosing one or several options that stay selected; the group does not track pressed or selected state. - Unrelated actions that happen to sit next to each other; plain spacing communicates independence better than a shared border. - More than about four or five actions; move the rest behind a dropdown menu instead of growing the group. ### Alternatives - `toggle-group`: Options with a single or multiple selection model and arrow-key navigation. - `dropdown-menu`: Several secondary actions behind one trigger when the row would overflow. - `tabs`: Switching between panels of content rather than triggering actions. ### Avoid - Using ButtonGroup as a segmented control and styling one button as 'active'; that state is invisible to assistive technology. Use toggle-group. - Expecting arrow-key navigation: ButtonGroup is not a toolbar or roving-tabindex widget, every button is its own Tab stop. - Mixing primary filled and neutral stroke buttons in one group so the joined edges clash; keep one emphasis per group unless it is a split button. - Icon-only buttons without aria-label inside the group. - Leaving a group of icon-only buttons unnamed when its purpose is not obvious from the surrounding heading. ### Accessibility contract - Each button is a separate Tab stop and activates with Enter or Space; the group adds no keyboard handling. - Focus moves in DOM order: left to right for horizontal groups, top to bottom for vertical groups. - Hover, pressed, disabled and loading states come from each Button; disabling one button does not disable the group. - A split-button trigger opens its dropdown menu with Enter, Space or ArrowDown, following the menu's own keyboard behavior. - text-contrast: Normal text and placeholders meet 4.5:1; large text meets 3:1. Check actual backgrounds in both themes and relevant hover/focus/selected/invalid states. Disabled exceptions do not apply to enabled outside-calendar days. - reflow: Preserve content and actions at 320, 390, 768 and 1440 CSS px. Contain intentional two-dimensional scrolling. Review 200% text enlargement and actual browser zoom separately. - state-meaning: Convey meaningful status or selection through semantics and text/shape as appropriate, not color alone. Do not make passive parts focusable merely to fill a state matrix. - keyboard-focus: Every operable control has a visible focus indicator and logical keyboard use. Keep focus reachable and unobscured. Review indicator contrast against adjacent surfaces. - accessible-name: Actions and inputs have contextual accessible names. Icon-only controls need a name; repeated navigation landmarks need distinguishable names. Visible label text remains in the accessible name. - reduced-motion: Respect reduced-motion preference in delivered code. Keep state and interaction understandable. Storybook animation overrides do not prove production behavior. Human review: design pending, screenReader pending. ### Examples #### Horizontal ```tsx "use client" import { AlignCenterIcon, AlignLeftIcon, AlignRightIcon } from "lucide-react" import { Button } from "@/components/ui/button" import { ButtonGroup, ButtonGroupSeparator } from "@/components/ui/button-group" export function ButtonGroupHorizontal() { return (
) } ``` #### Vertical ```tsx "use client" import { Button } from "@/components/ui/button" import { ButtonGroup, ButtonGroupSeparator } from "@/components/ui/button-group" export function ButtonGroupVertical() { return (
) } ``` #### Text actions ```tsx "use client" import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react" import { Button } from "@/components/ui/button" import { ButtonGroup } from "@/components/ui/button-group" export function ButtonGroupTextActions() { return (
) } ``` #### Small ```tsx "use client" import { Button } from "@/components/ui/button" import { ButtonGroup } from "@/components/ui/button-group" export function ButtonGroupSmall() { return (
) } ``` #### Split button ```tsx "use client" import { ChevronDownIcon } from "lucide-react" import { Button } from "@/components/ui/button" import { ButtonGroup, ButtonGroupSeparator } from "@/components/ui/button-group" import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu" export function ButtonGroupSplitButton() { return (
Save and publish Save as template
) } ``` #### Full width stacked ```tsx "use client" import { Button } from "@/components/ui/button" import { ButtonGroup } from "@/components/ui/button-group" export function ButtonGroupFullWidthStacked() { return (
) } ``` #### With icons ```tsx "use client" import { CopyIcon, DownloadIcon, Share2Icon } from "lucide-react" import { Button } from "@/components/ui/button" import { ButtonGroup } from "@/components/ui/button-group" export function ButtonGroupWithIcons() { return (
) } ``` #### With dot ```tsx "use client" import { Button } from "@/components/ui/button" import { ButtonGroup } from "@/components/ui/button-group" export function ButtonGroupWithDot() { return (
) } ``` #### Disabled item ```tsx "use client" import { Button } from "@/components/ui/button" import { ButtonGroup } from "@/components/ui/button-group" export function ButtonGroupDisabledItem() { return (
) } ``` ## Badge Docs: https://tdpxl.designproject.io/docs/components/badge.md Install: `npx @thedesignproject/tdpxl add badge` Purpose: Label an object with a short status, category or count that people scan rather than read. ### API Source-derived. Parts also accept the standard DOM props their element allows (className, ref, aria-*, event handlers). - `Badge`: Show a compact textual category, count, or status. - `color`: `"gray" | "blue" | "green" | "orange" | "red" | "purple"` (default "gray"). Semantic color role for the badge. Pair meaningful status colors with readable text; colors remain customizable. - `emphasis`: `"filled" | "stroke" | "lighter" | "light" | null` (default "lighter"). Visual treatment: filled, light, lighter or stroke. It does not add status semantics by itself. - `iconOnly`: `boolean` (default false). Square badge for a single icon. Provide aria-label (the badge then gets role="img") or visually hidden text, because there is no visible label. Defaults to false. - `dot`: `boolean` (default false). Show a small decorative dot before the label in the badge's color role. The label must still state the meaning. Defaults to false. - `removeLabel`: `string`. Accessible name for the remove button. Defaults to "Remove