Using components
How to find the right component, install it, read its page and make it yours.
The gallery 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: the building blocks, grouped by job (primitives, forms, overlays, navigation, feedback, data and chat).
- Charts: chart families, each with its variants.
- Blocks: complete sections and pages (login, dashboard, settings) composed from components.
- Hooks: small React hooks some components depend on.
Read a component page
Every component page in the gallery follows the same order:
- Installation: the command and the files it writes.
- Examples: each example in its own frame, with the code as you would write it.
- API reference: props generated from the TypeScript source, with the inherited DOM props listed separately.
- Accessibility & usage: when to use it, its parts, keyboard and interaction, responsive behavior and content guidelines.
Install
npx @tdpxl/cli add button
npx @tdpxl/cli add dialog field inputadd copies the source into your project, plus any other tdpxl items and npm
packages it imports. Run init once first. Files land where
tdpxl.json says (by default components/ui/); see CLI 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-baserestyles all of them. See Theming and Customizing. - Variants: components describe intent and emphasis instead of a single
variant. A Button takesintent,emphasisandsize; 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 @tdpxl/cli checkre-checks contrast in both themes and flags raw palette classes, hex values anddark:variants.
Keep up to date
Copied code does not update itself. When the registry changes:
npx @tdpxl/cli diff
npx @tdpxl/cli update buttondiff 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.
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.
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.
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 @tdpxl/cli add use-mobile |
use-inert-background | Pairs Radix modal background hiding with native inert, restoring the previous state on close. Exports useInertBackground. | npx @tdpxl/cli add use-inert-background |
With an AI agent
Each installed component comes with a <name>.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 @tdpxl/cli check
afterwards. See AI agents.