Design SystemsMar 28, 20267 min

Treating design tokens like a public API

Tokens are not a stylesheet. They're a contract between design and engineering — and the moment you treat them as anything less, the system rots.

HAL
Hoang Anh Luong
Front-end Developer · Brooklyn, NY
— color tokensember/500#FFB37Aember/200#FFD9BDember/900#7A3A18neutral/950#1A1413neutral/100#E8E4E1

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat — and that's just the warm-up. The interesting part comes when the real-world constraints meet the textbook theory.

The setup

I've been thinking about this problem for a while now. The first time I noticed it was on a Tuesday afternoon, debugging a render path that should have been instantaneous. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore. The numbers said one thing, the user-facing experience said another, and I'd seen this disagreement enough times to know it wasn't a measurement bug.

What surprised me

Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. The conventional wisdom is that you should optimize the hot path, ship, and measure. The conventional wisdom is mostly right — but it has a blind spot.

The thing nobody mentions is that the hot path moves around. The optimization you ship today is the bottleneck you debug in six months.

How I'd do it now

Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium. Three things I'd do differently with another year of hindsight: instrument earlier, write down the hypothesis before running the experiment, and resist the urge to ship the first version that works.

  1. Instrument before you optimize. The first hour of any perf work should be establishing a baseline you trust.
  2. Write down what you expect to happen. Half the value of a measurement is the gap between prediction and result.
  3. Resist the urge to ship the first thing that works. The second version is the real product.

Code, briefly

A small example — placeholder, but the shape is right.

// app/[slug]/page.tsx
export default async function Post({ params }) {
  const post = await getPost(params.slug);
  return (
    <article>
      <h1>{post.title}</h1>
      <Markdown>{post.body}</Markdown>
    </article>
  );
}

Closing

Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores. If you've made it this far and want to discuss any of this, the contact form on the home page works. So does email. I'd love to hear what you're working on.

#Tokens#Design Systems#Process

Get new posts in your inbox.

One email when something new goes up. No tracking, no other lists, easy unsubscribe.