Building a Design System from Scratch
Build a design system in four layers, in this order: an audit of what the product already contains, design tokens for color, type, spacing and shape, a small set of core components that read only from those tokens, and then documented patterns and a named owner. Ship a small, complete first version before planning a large one.
Teams that skip a layer usually pay for it later. Components built before tokens hard-code values that later have to be hunted down. Tokens without an owner drift into dozens of near-duplicates. The sections below cover each layer with the specific decisions involved, a token file in the current community format, and the governance rules that keep the system from turning back into a pile of exceptions.
Layer 0: audit the product before designing anything
A design system should describe what the product already does, made consistent, not an ideal product nobody has built. So the first deliverable is an inventory, not a component.
Work through the live product and record every distinct instance of these, with a screenshot and the place it appears:
| Inventory item | What to record | What the duplicates become |
|---|---|---|
| Buttons | Fill, border, radius, padding, font size, every state you can trigger | Button variants and sizes |
| Text styles | Font family, size, weight, line height, where used | The type scale |
| Colors | Every hex or rgb value in CSS and design files, with its job (text, border, background, status) | Color tokens, grouped by role |
| Spacing | Margins, paddings and gaps in use | The spacing scale |
| Form controls | Inputs, selects, checkboxes, their error and disabled states | Form components and the form pattern |
| Feedback | Toasts, banners, inline errors, empty states | Feedback components and patterns |
Most audits show the same thing: a handful of values do most of the work, and a long tail of one-offs appeared because nobody had a shared option to reach for. The audit is where you decide which values to keep and which to retire. Write the decision next to each retired value ("13px text replaced by 14px small") so the migration later is mechanical.
Two things to resist during the audit. Do not fix anything yet; a half-fixed screen muddies the inventory. And do not let the loudest stakeholder's favorite screen become the template. The counts decide.
Layer 1: design tokens
Tokens are named design decisions: a color for body text, a step in the spacing scale, a corner radius. They are defined once and referenced everywhere, so a change in one place changes every component that uses it. Atlassian's design system describes them as name and value pairs that represent small, repeatable design decisions, which is about as precise as a definition gets.
Three tiers, not one flat list
Large systems split tokens by how far they are from a raw value. Material's web components document three tiers:
- Reference tokens hold concrete values, such as
--md-ref-typeface-brand. - System tokens hold design roles, such as
--md-sys-color-primaryor--md-sys-typescale-body-medium-size. - Component tokens apply roles to one component, such as
--md-filled-button-container-color.
A component token points at a system token, which points at a reference value. When the brand color changes, you edit one reference token, and every button, link and chart that uses the primary role follows.
Smaller teams can use two tiers: primitives (the raw palette and scales) and semantic tokens (the roles components use). Skip component tokens until a component genuinely needs to diverge from the shared roles.
Name tokens by job, not by appearance
Atlassian builds token names from a foundation, a property and an optional modifier, as in color.icon.success: the foundation is color, the property is icon, and the modifier says what the icon communicates. Its guidance is direct: choose tokens for their meaning, not because the color happens to match, since a token that matches in the light theme may be wrong in another theme.
IBM Carbon takes the same position. Its theme documentation defines a token as a role-based identifier that never changes across themes, while its value does. Carbon ships four default themes (White, Gray 10, Gray 90 and Gray 100), and a token like $text-primary is a dark gray in White and a light gray in Gray 100. GitHub's Primer primitives list nine color themes, including colorblind, tritanopia and high-contrast variants for both light and dark. That breadth is only possible because components reference roles, never raw colors.
The practical test for a token name: if the brand color changed from blue to green tomorrow, would the name still be true? color.text.danger survives. color.red.600 used for error text does not, because the meaning was never in the name.
A spacing scale with a base unit
Pick one base unit and derive every spacing value from it. Atlassian uses an 8px base, written as space.100, with the number standing for a percentage of the base: space.050 is 4px, space.200 is 16px and space.1000 is 80px. Its scale also includes half steps such as space.075 (6px) and space.150 (12px) for compact controls.
A starting scale for a new system, in rem so it follows the reader's root size:
| Token | rem | px at a 16px root | Typical use |
|---|---|---|---|
| space.050 | 0.25 | 4 | Icon to label gap, badge padding |
| space.100 | 0.5 | 8 | Input padding, tight stacks |
| space.150 | 0.75 | 12 | Button padding, list item gaps |
| space.200 | 1 | 16 | Card padding, form field gaps |
| space.300 | 1.5 | 24 | Section gaps inside a card |
| space.400 | 2 | 32 | Gaps between cards |
| space.600 | 3 | 48 | Page section spacing |
| space.800 | 4 | 64 | Hero and major layout breaks |
Borrowing the percentage-of-base naming means a new value slots in without renaming anything: a 20px gap becomes space.250. Naming steps 1, 2, 3 breaks the moment you need something between 2 and 3.
Storing tokens in the community format
Tokens can live in CSS custom properties alone, and for one web product that is enough. Once you need the same tokens in Figma, iOS and Android, you need a neutral source file that tools can transform. The Design Tokens Community Group published the Design Tokens Format Module 2025.10 as a Final Community Group Report on October 28, 2025. It is not a W3C Standard or on the W3C Standards Track, but it is the format most token tools are converging on.
The rules that matter for a first file:
- A token is a JSON object with a
$value; its key is the token name.$typedeclares the type and can be set on a group so every token inside inherits it. - Dimension values are objects with a numeric
valueand aunit, and the unit must bepxorrem. - An alias is written in curly braces with a dot path, such as
{space.200}, and resolves to that token's value. - Recommended file extensions are
.tokensor.tokens.json, with the media typeapplication/design-tokens+json.
{
"space": {
"$type": "dimension",
"050": { "$value": { "value": 0.25, "unit": "rem" } },
"100": { "$value": { "value": 0.5, "unit": "rem" } },
"200": { "$value": { "value": 1, "unit": "rem" } }
},
"font": {
"weight": {
"$type": "fontWeight",
"regular": { "$value": 400 },
"bold": { "$value": 700 }
}
},
"component": {
"card": {
"padding": {
"$type": "dimension",
"$value": "{space.200}",
"$description": "Inner padding for all card variants"
}
}
}
}
Style Dictionary, a widely used open-source token transformer, states first-class support for the DTCG format as of its version 4, and notes that full support for the 2025.10 revision is still in progress for version 5. Check that your chosen tool reads the exact features you use, aliases and composite types in particular, before you commit the format.
The CSS that a build step would produce from a file like this looks like the block below. Color values here are illustrative, not a recommended palette:
:root {
--color-primary-500: oklch(0.62 0.19 250);
--color-primary-600: oklch(0.55 0.22 250);
--color-text-danger: oklch(0.5 0.2 25);
--space-050: 0.25rem;
--space-100: 0.5rem;
--space-200: 1rem;
--radius-sm: 0.375rem;
--radius-lg: 0.75rem;
--card-padding: var(--space-200);
}
Type tokens deserve their own care: each size needs its line height, and fluid headings need a zoom check. Our typography scale guide walks through deriving those values. Color ramps are where color theory for web designers turns into production tokens, and the accessible color systems guide covers building ramps whose text and background pairs pass contrast checks. If dark mode is on the roadmap, plan the semantic tier now; our dark mode design guide explains why swapping a role's value is far easier than retrofitting raw colors.
Layer 2: core components
Build the components everything else is made of, roughly in the order other components depend on them: button, text input, checkbox and radio, select, badge, card, avatar, tooltip, dialog, tabs and toast.
For each one, settle five things before anyone draws it:
- Variants. For a button: primary, secondary, subtle and danger. Cap the list. Every variant multiplies the states you must design, build, document and test.
- States. Default, hover, focus, active, disabled and loading. WCAG 2.2 success criterion 2.4.7 (Focus Visible, Level AA) requires a visible keyboard focus indicator, so focus is a required state, not a nice-to-have.
- Sizes. Small, medium and large at most, each tied to spacing and type tokens.
- Edges. What happens with a 60-character label, an empty value, a validation error, or right-to-left text.
- Interface. The props or attributes, decided before the visuals. If a button needs a dozen boolean props to express its variants, the variants were never decided; collapse them into one
variantprop with named values.
Accessibility checks that belong in the component, not the screen
Some accessibility requirements can only be met once, inside the component. If the component gets them right, every screen inherits the fix:
| Requirement | Source | Where it lives |
|---|---|---|
| Text contrast at least 4.5:1, or 3:1 for large text (about 24px, or about 18.5px bold) | WCAG 2.2 SC 1.4.3, Level AA | Color tokens for text on each surface |
| Contrast of at least 3:1 for the visual parts that identify a control and its state, such as an input border | WCAG 2.2 SC 1.4.11, Level AA | Border and focus-ring tokens |
| Visible keyboard focus | WCAG 2.2 SC 2.4.7, Level AA | Focus style in every interactive component |
| Dialog keeps Tab and Shift+Tab inside, closes on Escape, returns focus to the trigger | WAI-ARIA Authoring Practices, modal dialog pattern | The dialog component |
The 1.4.11 threshold is not rounded: W3C's Understanding document says 2.999:1 fails. Bake the check into token review, not just into page audits. Our WCAG 2.2 compliance guide covers the remaining Level AA criteria.
Layer 3: patterns
Patterns are recipes for recurring problems that no single component can solve: a form with validation, a data table with sorting and an empty state, search with results, a settings page, an onboarding flow, an error page.
Write each pattern as a recipe: the layout, the components it uses, the copy rules, and the edge cases. A form pattern, for example, decides:
- Labels above fields, never placeholder-only labels.
- Required fields marked in text, not by color alone.
- Error messages placed under the field, written as what to do ("Enter a date after today"), and summarized at the top on submit for long forms.
- What the submit button does while saving, and where focus goes after a failure.
These decisions are where products drift most, because each team makes them slightly differently. Writing them down once removes dozens of small debates.
Documentation: if it is not written, it does not exist
A component without documentation exists only for the people who built it. The minimum page per component:
- A live example people can interact with, showing every variant and state.
- When to use it, and when to use something else instead. "Use a dialog for a decision that blocks progress; use a side panel for reference content people want to keep open while they work."
- Accessibility notes: keyboard behavior, the role it exposes, how focus moves.
- A copy-ready code snippet and the matching design-library component name.
- The reasons behind non-obvious decisions, so contributors extend the system the same way.
Storybook is a common choice for live component documentation, but a plain docs site with embedded examples works too. The tool matters less than the rule that docs ship in the same change as the component.
Governance: who can say no
Systems decay in two directions: neglect, where nobody maintains them, and sprawl, where everybody adds to them. Both need a process.
- A named owner or small council. Anyone can propose a component or variant; the owner decides. Without someone empowered to decline one-offs, the system fills with near-duplicates.
- A contribution path with criteria. A useful rule of thumb: a component joins the system when at least three places need it. Before that, it lives in the product code.
- Versioning that tells people what will break. Semantic Versioning 2.0.0 is a good fit for component packages: a major version for incompatible changes, a minor version for backward-compatible additions, a patch for fixes. It also says the minor version must be incremented when public functionality is marked as deprecated, which gives teams a release to migrate before removal in the next major version.
- Deprecate before deleting. Mark the old component, name its replacement, give a removal version, and remove it only in a major release.
- Scheduled usage reviews. Check which components and tokens are actually used. Unused ones are deprecation candidates; one-off styles that keep reappearing are candidates for the system.
Tooling: start small
- Design files. Figma variables can hold color and number values and support modes, so one variable can carry different values for light and dark themes. Keep variable names identical to code token names; drift between design and code is the most common way a system quietly splits in two.
- Token pipeline. CSS custom properties are enough for one web product. Add a DTCG-format source file and a transformer such as Style Dictionary when you need the same tokens on other platforms.
- Component code. Build in the framework your product uses. A design system does not need its own framework.
- Linting. A custom lint rule that rejects raw hex colors and pixel spacing in component files catches regressions at review time, before they reach a screen. Start with colors, where hard-coded values do the most damage to theming.
Tokens in a CSS file plus a documented component folder beat an elaborate toolchain nobody maintains.
Worked example: a first version for a four-person product team
This is an illustration with stated inputs, not a case study. The team: two designers and two front-end developers on a B2B scheduling product, building the system alongside normal feature work.
Audit results (illustrative). The inventory turns up 11 distinct button treatments, 9 text sizes between 12px and 15px, 23 unique grays, and spacing values in increments of 1px from 2px to 40px.
Decisions.
| Area | Kept | Retired |
|---|---|---|
| Buttons | 4 variants (primary, secondary, subtle, danger), 2 sizes | 7 treatments, mapped to the nearest kept variant |
| Text | 7 sizes from a 1.2 ratio scale | 6 of the 9 small sizes |
| Grays | 8 neutral steps, assigned to text, border and surface roles | 15 grays |
| Spacing | The 8 tokens in the spacing table above | All other values, rounded to the nearest token |
Version 1 scope. Tokens, plus 12 components: button, text input, textarea, checkbox, radio, select, badge, card, tooltip, dialog, tabs and toast. One pattern (forms), because the audit showed forms had the most inconsistency.
Pilot area. The settings section, rebuilt entirely with the system. It is self-contained, it uses most of the 12 components, and it has enough forms to test the form pattern properly.
What the pilot exposed. The select component had no way to show a long option list with search, so a combobox was added to the backlog. The dialog's focus return failed when the trigger button was removed after a delete action; the fix followed the ARIA Authoring Practices note that focus should go to a logical place in the workflow when the trigger no longer exists.
How long it takes depends on four things. The number of components in scope, how many states each needs, whether the team must support more than one platform, and how much time is set aside from feature work. A team that cannot name those four inputs cannot produce a credible estimate, which is a useful signal in itself.
Rolling the system out
- Start with one contained area, as in the example, and make it a reference implementation others can copy.
- Migrate when you touch a screen. When a team works on an old screen for another reason, it moves that screen to the system. Track the share of screens migrated so the effort stays visible.
- Explain the reasons. A walkthrough of why the spacing base is 8px or why there are four button variants does more than a link to the docs. People follow rules they understand.
- Make the system the easy path. Starter templates, snippets and a published design library should make using the system faster than building custom.
- Treat resistance as a bug report. Teams that avoid the system usually hit a real gap. Fill it, and the objection usually goes away.
- Report what you can measure. Count components used versus one-off styles added, accessibility issues found in components versus screens, and time to build comparable screens before and after. Report your own numbers, not borrowed ones.
Common mistakes
| Mistake | What happens | Fix |
|---|---|---|
| Designing 80 components before shipping any | Nothing ships; teams keep building their own | Ship tokens plus a dozen core components first |
| Tokens named after colors | Renaming every token when the brand or theme changes | Role-based names in the semantic tier |
| Components that read raw values | Theme changes miss those components | Lint for raw values; components read tokens only |
| No usage rules | Components used in the wrong places; inconsistency returns | Document when to use and when not to for each |
| No owner | Near-duplicate variants pile up | Named owner with authority to decline |
| Figma and code names differ | Design and code drift apart | One naming source, mirrored in both |
| Deleting components without notice | Product builds break | Deprecate in a minor release, remove in a major |
Frequently asked questions
Should a small startup bother with a design system?
A light one, yes: tokens and the components you already use on every screen. Leave the council, multi-brand theming and token pipeline until more teams depend on it. The cost of having no shared tokens arrives early, usually the first time someone has to change the brand color across a product built from copied hex values.
How many components should version 1 include?
Enough to build one real area of the product end to end, and no more. For most web apps that is somewhere around a dozen: the form controls, a button, a card, a dialog, tabs and a feedback component. Speculative components can wait until three places need them.
Do we need the DTCG token format from day one?
Not for a single web product. CSS custom properties are a complete token system for one codebase. Adopt the DTCG format when a second platform or a design-tool sync needs the same values, and check your transformer's support for the 2025.10 revision first.
How do design tokens stay in sync between Figma and code?
Pick one source of truth. Either code owns the values and a script updates Figma variables, or a DTCG file owns them and both Figma and code are generated from it. Manual mirroring works only while one person changes both sides and checks the names match exactly.
When should a team stop adding to the system?
When a request serves one screen. The system grows by patterns that repeat, not by individual requests. A declined request should get a reason and a suggestion, such as an existing variant or composing two components, so the requester does not quietly fork the component instead.
Specs and docs behind this guide
Every rule, version and figure on this page was checked against these sources on October 22, 2026:
- Design Tokens Community Group, Design Tokens Format Module 2025.10 (Final Community Group Report, October 28, 2025). https://www.designtokens.org/tr/2025.10/format/ (checked October 22, 2026)
- Style Dictionary, DTCG format support notes. https://styledictionary.com/info/dtcg/ (checked October 22, 2026)
- Material Web, theming docs on reference, system and component tokens. https://github.com/material-components/material-web/blob/main/docs/theming/README.md (checked October 22, 2026)
- Atlassian Design System, design tokens. https://atlassian.design/foundations/tokens/design-tokens (checked October 22, 2026)
- Atlassian Design System, spacing. https://atlassian.design/foundations/spacing (checked October 22, 2026)
- IBM Carbon Design System, themes overview. https://carbondesignsystem.com/elements/themes/overview/ (checked October 22, 2026)
- GitHub Primer, primitives and themes. https://primer.style/product/primitives/ (checked October 22, 2026)
- W3C, Understanding WCAG 2.2 SC 1.4.3 Contrast (Minimum). https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html (checked October 22, 2026)
- W3C, Understanding WCAG 2.2 SC 1.4.11 Non-text Contrast. https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html (checked October 22, 2026)
- W3C, Understanding WCAG 2.2 SC 2.4.7 Focus Visible. https://www.w3.org/WAI/WCAG22/Understanding/focus-visible.html (checked October 22, 2026)
- W3C WAI-ARIA Authoring Practices, dialog (modal) pattern. https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/ (checked October 22, 2026)
- Ant Design, customize theme (seed, map and alias tokens). https://ant.design/docs/react/customize-theme (checked October 22, 2026)
- Microsoft Fluent 2, what is new. https://fluent2.microsoft.design/get-started/whatisnew (checked October 22, 2026)
- Semantic Versioning 2.0.0. https://semver.org/ (checked October 22, 2026)
- Figma Help Center, guide to variables. https://help.figma.com/hc/en-us/articles/15339657135383-Guide-to-variables-in-Figma (checked October 22, 2026)
Systems worth studying before you build
- IBM Carbon Design System review: role-based tokens across four default themes
- Material Design 3 review: reference, system and component token tiers
- GitHub Primer review: one token source with nine color themes, including colorblind and high-contrast variants
- Atlassian Design System review: foundation, property and modifier token naming
- Microsoft Fluent UI review: a design language Microsoft describes as adapting to each platform it supports
- Shopify Polaris review: Shopify's design system, useful for studying how a platform documents its patterns
- Salesforce Lightning (SLDS) review: Salesforce's design system, a reference for enterprise CRM interfaces
- Ant Design review: seed, map and alias token layers, where the docs say map tokens derive from seed tokens and alias tokens derive from map tokens
- Uber Base (Base Web) review: a production open-source system to compare against your own choices
- Adobe Spectrum review: behavior separated from styling, with React Aria hooks reusable in a custom component library
- Chakra UI review: accessible React components with style props and theming, built on Ark UI primitives
Next step
If you are deciding whether to start from an existing kit instead of a blank file, read our UI kit selection guide next: its license and coverage checks tell you whether a kit can become the starting point for the tokens and components described here.