Design tokens
5 minA design token is a named decision, such as your action colour or the radius of every control. Change it once and every component that reads it follows. Try it on a checkout below.
Lesson video
Tastebud · 5:05 · Captions on screen
Name each design decision once as a token, and have every component read the name, never the value.
- Why. Values typed by hand drift. One brand blue pasted into forty files turns into three slightly different blues, and a rebrand means finding all forty.
- Real example. Blade's primary button holds no hex code. It reads interactive.background.primary.default, which points at the brand blue, azure 500. Change that blue and every primary button follows. (Blade, Razorpay's design system, Nov 2026)
- When to break it. A one-off nudge, like moving an icon 1px to sit on the text line, can stay a plain number. A token nobody reuses only adds a name to learn.
- Common mistake. Naming a token for its colour, like --blue-button. When the brand turns green, the name is wrong in every file, or you rename it everywhere.
Our take. A hex code inside a component is a bug, even when it's the right colour. Components read purpose names like --color-action, and raw values live in one token file.
Two layers: the raw value and the job
Many systems use two layers. Raw tokens hold the palette, like --blue-700. Purpose tokens name a job, like --color-action, and point at a raw one. Components read only purpose tokens, so a rebrand changes one pointer.
Components read the job name; only the token file knows the value
- Raw tokens. --blue-700: #1a56db. One line per colour in the palette. Components never read these.
- Purpose tokens. --color-action: var(--blue-700). The name says the job, and the value points at a raw token.
- Components. .pay { background: var(--color-action); } Every button, link and focus ring reads the purpose name.
Swap hard coded values for tokens
A search for # and px finds the hand-typed values. Each hex code or size that repeats a decision becomes a var() that reads its token, and the value lives in one place, the :root block at the top.
Each hand-typed value becomes a var() that reads one line in :root
- Search for # and px. Every hex code or size typed into a rule shows up. Here: #1a56db twice and 8px once.
- Match each to its token. #1a56db is the action colour, so --color-action. 8px is the corner of a control, so --radius-control.
- Swap in var(). .pay { background: var(--color-action); } and the same for the radius and the coupon link.
- Values live in :root. No hex code is left below the :root block at the top.
- One edit, everything follows. Change #1a56db to #0b6e4f inside :root, and the button, its focus ring and the link all turn green.
Name each token for the job it does
A good token name says what the value is for. --color-action still makes sense after the brand changes colour. Raw palette names like --blue-700 are fine in the token file, as long as components never read them.
- --blue-700: raw palette, so a button stays blue after a rebrand
- --red-600: raw palette, which --color-text-error points at
- --blue-button: half job, half colour, so rename it --color-action
- --color-action: the colour of the main action
- --color-text-error: the colour of error messages
- --radius-control: the corners of buttons and fields
Try it
Change one token, watch every component
Every part of this checkout reads from the same four tokens. Change a value, or switch to the rebrand, and see what follows.
--color-action--radius-control--space-inset--font-size-body
Nothing yet. Every part of the preview reads the same tokens, so one change reaches all of them.
What to notice: Drag the radius: the card, badge, field and button all round together. Then pick a pale yellow for the action colour, and the Pay label, the badge and the coupon link all turn hard to read at once. A token spreads a bad value as fast as a good one.
Find the hex codes and replace them
The Pay button and the coupon link each typed the brand blue by hand, and the button typed its radius too. Swap each one for the token in :root that names it.
Tab adds two spaces. Press Esc, then Tab, to leave the editor.
- The button's fill reads var(--color-action) (not yet)
- The button's corners read var(--radius-control) (not yet)
- The coupon link reads var(--color-action) (not yet)
- No hex codes left below :root (not yet)
What to notice: When all four tick, change #1a56db inside :root to #0b6e4f. The button, its focus ring and the link all turn green from that one edit.
Quick check
Your Pay button, links and focus rings use #1a56db, typed by hand in 14 files. Marketing changes the brand blue. What do you do first?
Watch next
Watch it for How a token in Figma, stored as a variable, names a decision that styles and components then reuse.
Watch it for Declaring custom properties on :root and reading them with var(), the same move the token panel makes.
Connects to: 3.6 CSS variables and the cascade · 6.1 Thinking in components · 10.6 Reduced motion · 12.3 Handing off tokens · 16.4 Material 3 theming
Sources · checked Nov 2026
- Blade on GitHub: READMEBlade is the design system that powers Razorpay, and it's open source
- Blade source: bladeTheme.tsinteractive.background.primary.default points at the global colour azure 500
- Blade source: global colors.tschromatic.azure[500] is hsla(218, 89%, 51%, opacity[1300]), and opacity 1300 is 1.0
- Blade source: buttonTokens.tsThe primary Button's background reads interactive.background.primary.default
- Blade source: createTheme.tscreateTheme({ brandColor }) builds a whole theme from one brand colour
- Blade releasesGitHub release @razorpay/blade@12.132.0, 25 Nov 2026, matching packages/blade/package.json on master (on 26 Nov 2026 npm still served 12.131.0 as latest)
- Design Tokens Format Module 2025.10A token is information with a human readable name; $value and $type; aliases in curly braces; .tokens.json files; first stable version 28 Oct 2025
- Design Tokens Color Module 2025.10A colour token's $value is an object with colorSpace, components and an optional hex
- Web Platform Status: Custom propertiesCSS custom properties are Baseline widely available (since 2019 in every major browser)