Skip to content
tezvyn:

What is a design token versus a CSS or Sass variable?

Source: w3.orgEasyHow cards are made

Whether you understand abstraction layers in design systems and cross-platform interoperability. Define tokens as vendor-neutral design decisions that generate platform-specific code; contrast with CSS variables (runtime, web-only) and Sass (compile-time…

What's really being asked

This question tests whether you understand the architectural boundary between design decisions and platform implementation. Interviewers want to know if you view tokens as a cross-platform interoperability standard rather than a web-only convenience layer. The distinction matters because senior engineers must decide when to introduce token pipelines versus relying on native theming.

The full answer

First, define design tokens as vendor-neutral representations of design decisions maintained in a standardized format. Mention that the W3C Design Tokens Community Group specifies a format for encoding colors, typography, spacing, and themes so tools like Figma and Style Dictionary can share a single source of truth. Second, contrast CSS custom properties which are runtime web values scoped to the browser cascade, and Sass variables which are compile-time abstractions that vanish in the output CSS. Third, emphasize that tokens generate platform-specific deliverables for iOS, Android, web, and Flutter from one file, whereas CSS and Sass are web-only. Fourth, note advanced token features like aliases, inheritance, and multi-brand theming that exceed what simple preprocessor variables offer.

The mistakes people make

A red flag is saying tokens are just variables with semantic names. Another mistake is claiming Sass variables and tokens solve the same problem because both use names; this ignores the cross-platform delivery pipeline. Confusing tokens with CSS custom properties is also weak because it misses the design-to-code workflow and tool interoperability that the W3C specification enables.

What usually comes next

The interviewer may ask how you would migrate an existing Sass-based theme to a token architecture, or how to handle token versioning across native mobile and web releases. They might also probe performance by asking whether runtime CSS variables or build-time token resolution is preferable for theme switching.

A concrete example

Imagine a multi-brand system supporting light and dark modes. A token file defines color-background-primary as an alias to color-core-blue-500 in brand A and color-core-green-500 in brand B, with a dark-mode override to the 700 shade. This single token file feeds Style Dictionary to emit Swift constants, Android XML, and CSS custom properties. A Sass variable cannot produce Swift or Android output, and a CSS variable cannot encode the design-tool semantics or cross-brand aliases.

Interview question

When migrating a web-only Sass theme to support both Android and iOS, what is the main reason to adopt design tokens?

  • a.Because tokens are defined in a vendor-neutral format that can generate Android XML, Swift constants, and CSS from one file, while Sass only outputs CSSCorrect
  • b.Because design tokens act as runtime CSS custom properties that native apps can read directly from the browser cascade
  • c.Because tokens provide semantic names like color-primary that Sass variables cannot support
  • d.Because Sass variables require a JavaScript runtime to resolve values, making them incompatible with native mobile build pipelines
Why?

Design tokens use a vendor-neutral format to generate iOS, Android, and web code from one source, while Sass variables compile only to CSS. Distractor C is tempting because it confuses tokens with CSS custom properties, which are runtime web values and cannot produce native mobile deliverables or encode cross-platform aliases.

Just read this? Test yourself on what you have been reading.

Read the original → w3.org

Put your scrolling time to good use

Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Open roles that interview on design systems — each one lists the topics its interview covers.

See open roles