Design systems
How Dex finds your components, how the designSystem setting describes them to agents, and how views are styled.
Views use your project’s own components. This page covers how create finds them, what designSystem in dex.config.ts holds, and how styles reach each view.
How create finds your components
create looks for these, in order:
- A shadcn
components.json, at the root or in a workspace package. Itsuialias is the components folder, and its CSS entry is your global styles. - A common folder with at least three components, such as
components/ui,src/components/uiorsrc/design-system. It checks the root, then each workspace package. - A folder you name, which skips the search:
npm create dex@latest -- --components packages/ui/src/components.
Imports match your app’s, from tsconfig paths (@/components/ui/button) or a package’s exports. A package that exports only its entry, such as @primer/react, is named as a whole, and views import from it as your app does.
When create finds nothing, it asks for a folder or offers to set up shadcn. Dex recognises MUI, Mantine, Chakra UI, Ant Design and Radix Themes and fills in their imports and styling. For Mantine, Chakra UI and Radix Themes, which need a provider, create also writes studio/provider.tsx.
To point Dex at a folder later, run npx dex components --components <folder>. It prints the designSystem.components value to add to dex.config.ts.
The designSystem setting
designSystem holds only what your project’s files can’t say. Dex reads the rest each time it starts, so in a shadcn project you can leave it out and edit components.json instead. A value in designSystem wins over what Dex reads. The components folder is scanned on every start, so new components appear without more setup.
export default defineConfig({
content: "./studio",
designSystem: {
name: "Acme UI",
components: {
folder: "./packages/ui/src/components",
import: "@acme/ui/components",
about: { button: { description: "One primary per view." } },
ignore: ["sonner"],
},
styles: ["./packages/ui/src/styles/globals.css"],
provider: "./packages/ui/src/provider.tsx",
},
});
| Field | What it sets |
|---|---|
name |
The name agents see. Default: the components’ package name. |
components |
A folder to scan (folder, import, about, ignore), a package name such as "@primer/react", or a list of { slug, name, import }. |
imports |
Paths views may import besides the components, such as "@acme/icons/*". |
styles |
Your global CSS, as paths or package specifiers. Name the source file, not a build output. |
styling |
tailwind, css-modules, stylex, vanilla-extract, css-in-js, plain-css or other. |
marker |
A selector that matches your components’ output, such as [data-slot], so agents can spot hand-built markup. |
provider |
A module whose default export wraps every view. See Configuration. |
guide |
Markdown on the design language. Default: DESIGN.md in the content folder. |
contributing |
Markdown on how to add or change a component. |
links, mcp |
Links to docs, Storybook or Figma, and your design system’s own MCP server. |
A design system can ship this as a preset: export defineDesignSystem({ … }) from @dexhq/canvas/config, then set designSystem: acme.
How views are styled
Each view renders on its own page, with your global CSS first and none of Dex’s interface styles. With Tailwind 3, your tailwind.config applies in views. A design system styled without Tailwind gets Tailwind’s utilities but not its reset, so its own rules aren’t overridden. Add build-time styling such as StyleX or vanilla-extract as a Vite plugin in plugins.
Unbuilt packages
doctor and dev warn when a package’s exports point at a build that doesn’t exist yet, and say how to build it:
! @acme/ui is not built, so views cannot import it. Build it first (in a monorepo, `npx turbo run build --filter=@acme/ui`).