Use Justified with shadcn
Justified’s theme and components are published as a shadcn registry. You add them with the same command you use for shadcn’s own components, and they land in your project as ordinary code that you own and can change. Is shadcn accessible? explains which decisions shadcn’s own components leave to you.
What you need
Section titled “What you need”- A React project with Tailwind CSS v4.
- shadcn set up in it, so the project has a
components.json. If it does not, run:
npx shadcn@latest init1. Add the theme
Section titled “1. Add the theme”npx shadcn@latest add https://blackwoodblake.com/design-system/r/justified-theme.jsonThis writes Justified’s tokens into your main CSS file: the colours in shadcn’s names, for light and dark, plus type, space, focus, target size, layout and motion. The durations stay the same when someone has asked their system for less motion: each component turns off its own movement with motion-reduce: and keeps its short fades, as VIS-006 asks.
Dark mode follows the dark class on an ancestor, as in shadcn.
The theme is also on npm, if you would rather keep the tokens as a dependency than as code in your CSS file. Install @blackwoodblake/justified-tokens and import its two files after Tailwind:
@import "tailwindcss";@import "@blackwoodblake/justified-tokens/tokens.css";@import "@blackwoodblake/justified-tokens/theme.css";Use one way or the other, not both. The registry suits most projects: you will likely change the colours to your brand, and the values are then your own code. The package suits a project that keeps Justified’s default theme and wants new values with npm update; to change a colour there, set the variable again after the imports.
2. Add components
Section titled “2. Add components”Add the ones you need. Each one brings what it depends on.
npx shadcn@latest add https://blackwoodblake.com/design-system/r/field.json https://blackwoodblake.com/design-system/r/input.json https://blackwoodblake.com/design-system/r/button.json| Component | Registry item |
|---|---|
| Field and FieldSet: label, hint and error wired to the control | field.json |
| Input | input.json |
| Textarea | textarea.json |
| Native select | native-select.json |
| Checkbox | checkbox.json |
| Radio group | radio-group.json |
| Switch | switch.json |
| Button | button.json |
| Label | label.json |
Justified’s button, label, checkbox, radio-group and switch replace shadcn’s components of the same name. They keep shadcn’s props, so existing code keeps working. The CLI asks before it overwrites a file.
The full list is in registry.json. Every component is shown in Storybook.
3. Build a field
Section titled “3. Build a field”import { Button } from "@/components/ui/button";import { Field } from "@/components/ui/field";import { Input } from "@/components/ui/input";
export function EmailForm({ error }: { error?: string }) { return ( <form noValidate className="flex max-w-md flex-col gap-6"> <Field label="Email address" hint="We send the receipt here." required error={error}> <Input type="email" autoComplete="email" /> </Field> <Button type="submit">Continue</Button> </form> );}Field gives the input a visible label, reads the hint and the error out with it, marks it as invalid and announces an error when it appears. Your form decides when there is an error: the rules FRM-002a and FRM-002b say where and when to show it. The sign-up example in Storybook shows a whole form that follows them.
Keep it up to date
Section titled “Keep it up to date”Run the same add command again to get a newer version of a component. If you have changed the file, the CLI asks before it overwrites it, so look at what you changed first.
Justified is an independent project. It is not affiliated with, sponsored or endorsed by the organisations whose guidance it cites. Read the full statement.
Apple is a trademark of Apple Inc., registered in the U.S. and other countries and regions.