← Back Explore Nebula

Nebula Design System · Learning project

One Figma file,
every component in sync

I built a design system from scratch to learn how real ones are made, and why they are made that way. Every colour, size and style is a token in Figma, generated into code, so components can only use system values. 1,343 tokens, 11 components, a docs site and a Storybook.

Problem

Values typed by hand drift apart, and a product's parts stop matching.

Solution

Components built as infrastructure: scalable, modular, styled only by tokens.

Goal

Zero hard-coded colours, and a system I can explain decision by decision.

The bet

I wanted to find out whether one Figma file could drive the code with zero hard-coded values. Result: 0 hard-coded colours in component code, and 30 sizes flagged openly because no token exists for them yet.

Role
Solo · system design in Figma, built with AI
Scope
Foundations, tokens, 11 components, docs
Tools
Figma variables · Style Dictionary · Tailwind · React · Storybook · Claude Code
1,343design tokens
3tiers: base → semantic → component
74text styles, mobile and desktop
60Storybook stories across 11 components

How it fits together, in three screens

Nebula docs site home page
1Docs siteFoundations, tokens and usage guidance, built from the Figma file.
Button page on the docs site
2A component pageExamples, anatomy, usage, props, tokens and a Figma review.
Button in Storybook with live controls
3StorybookEvery state on its own, with live controls and an accessibility check.
01 The principle

Components are the infrastructure of the product

Everything in Nebula follows from one idea: take large-scale components and build them in a scalable and modular way.

Component design

A product is assembled from components the way a building is assembled from its structure. Get them right once, and every screen inherits it.

Scalable

Scale up or scale down

One component covers every size and density through properties, not copies.

In NebulaButton has four sizes, xs to lg. The xs size was added for Empty State, without a second button.

Modular

Fix just that module

Each component is its own module, so maintaining or fixing one never touches the others.

In NebulaWhen Badge was replaced with a corrected Figma version, Tag, which uses Badge for its count, updated with no change of its own.

02 Context

A design system is a product of its own

It is design infrastructure: designed, maintained and improved, and its users are designers and developers.

Single source of truth

One place where every value is decided.

A common language

Designers and developers name things the same way.

A stable product

Branding and experience stay aligned across every touch point.

Governance

Changes follow a process instead of happening screen by screen.

03 Goals and scope

Three goals, and what I left out

A learning project needs a clear edge, or it never ends.

One source of truth

Figma variables are the only place a value is set. Code is generated from them.

Off-system is impossible

A class that isn't a token can't be written, and the audit fails if one slips in.

Explainable

Every component documents its tokens, states, accessibility and Figma review.

In scope

  • Colour, type, spacing, grid, elevation
  • Three-tier tokens and the code pipeline
  • 11 components, documented and tested

Out of scope, for now

  • Dark mode and multiple brands
  • Motion tokens (values proposed only)
  • Publishing as a package; use in a real product
04 Process

Build it like a monster, protect it like a child

Building and keeping are two different jobs, and a system needs both.

Build it like a monster

Be thorough and ambitious when building: cover every foundation, every token tier, every state.

  • Product audit
  • Style guide and tokenisation
  • Master library creation

Protect it like a child

Once released, guard it: changes go through a process, so it doesn't overload, drift apart and get abandoned.

  • Contribution is always open, but governed
  • Inconsistencies are removed, good patterns kept
  • The audit repeats: yearly, quarterly or every release

The steps I followed

From a loose vision to exact rules anyone can follow: strategy → framework → system → process.

Style guide
Colour, type, space, grid

Tokens
Base, semantic, component

Library
Figma component sets

Code
Built, audited, tested

Sanity audit
The system against its own rules

Docs
Site, Storybook, health

Auditing: what it looks like for a real product, and what I did

A real audit comes first and makes the case for the system. Nebula had no product to audit, so I audited the system itself, against its own rules.

For a real productMethod · not done for Nebula

The audit is the first of three phases: product audit → style guide and tokenisation → master library.

  1. Keep the patterns that work. They are added to the design system.
  2. Remove the inconsistencies.
  3. Extract the style guide, the fundamental building blocks, then tokenise it and build the master library.
  4. Update and report constantly to designers, engineers and stakeholders.

If the product is being redesigned, skip the audit and explore a new design language instead. Either way, the three phases repeat: quarterly, half-yearly or yearly.

What I did: a sanity audit of Nebula

Missing tokens · 30Raw sizes with no token: 2px and 10px spacing, 0.6px and 0.8px borders.
Class audit
Primitives used directlySome components bind base sizes, like base/size/10, where a semantic token should sit.
Figma
NamingStyles spelt “dekstop”; tags use tag-text in some states and badge-text in others.
Figma
Contrast · 3.5 : 1The secondary text grey fails WCAG AA (4.5 : 1) for body text.
Contrast check

Each finding stays visible: the code flags it, the Token health page lists it, and it shaped a later decision (the new text token, the naming rules).

05 Foundations

Foundations at a glance

The building blocks every component is made from. Colour and type get their own case studies below.

Colour →

17 HSL ramps, 10 steps each
AaManrope · Martian Mono

Typography →

74 styles, mobile and desktop

Spacing

Gaps grow with size: +2, +4, +8, +16, +32

Grid

4 · 6 · 12 columns at 360 · 768 · 1280

Rule

Why Nebula's spacing and grid are the way they are

SpacingSmall steps for small sizes, bigger jumps for big ones

4 · 6 · 8 (+2), 12 · 16 · 20 · 24 (+4), 32 · 40 · 48 (+8), 64 · 80 · 96 (+16), then +32 up to 256. Close values where precision matters, far apart where it doesn't.

GridDesign for the primary platform, at the worst scale first

360px, 4 columns for phones, 768px, 6 columns for tablets, 1280px, 12 columns for data-dense desktop. Margins on tablet sit between phone and laptop.

1

Case study 1 of 5 · Colour

A colour system that passes contrast, not just looks right

BetCan 17 ramps give every role (surface, text, border, icon) a step that is readable?

17 ramps, every step measured

Each hue has 10 steps, built in HSL, from light tints (lightness ≈ 95) to dark shades (≈ 25).

50100200300400500600700800900

passes 4.5 : 1 on white, so it can be used for body textComputed from the real tokens

The rules behind the ramps

Each rule, and where it shows in the real values.

Rule

What the Nebula ramps do

Lightness gapsSmall gaps at the light end, larger gaps in between, so neighbouring steps never look the same

Violet lightness: 96 → 92 → 86 → 78 → 68. Gaps of 4, 6, 8, 10, then a steady 8 down to 26.

SaturationLess saturation for darker colours, more for lighter ones, to meet contrast without going muddy

Violet saturation falls from 70 in the tints to 60–62 in the shades.

YellowHSL can't make a darker yellow stay bright, so lower the hue towards orange

Amber hue moves from 47° to 41° as it darkens.

Green and blueThey take up a lot of the colour gamut, so keep their saturation in check: around 55 for enterprise, 60–70 for consumer apps

Green saturation stays around 55 across the ramp.

Roles, not hues, in a 60-30-10 split

Components never ask for “violet-600”. They ask for a role, and the role points to a step.

60% · SurfaceWhite and grey surfaces carry most of the screen: subtle · soft · muted · default · strong · bold
30% · TextText in five weights: extrabold · bold · semibold · regular · light
10% · BrandViolet only for actions and highlights, plus success · warning · error · info for feedback

Contrast is a rule, not a look

Text under 24px needs 4.5 : 1 (AA). Large text, 24px or 18.66px bold, needs 3 : 1. Primary text and action colours aim for these first.

Chose

A new token, text/default/primary/medium (grey-600, 6.1 : 1)

Over

Darkening the existing secondary grey-500 (3.5 : 1)

Because

Changing an existing token silently changes every component that Figma already approved. A new token is a proposal I can review first.

Contrast check

When the check and the design disagreed

Storybook's accessibility check flags the Alert's colours as a serious contrast problem. I kept them as designed, and wrote it down.

Storybook accessibility panel showing a color-contrast violation on the Alert
Found4 component colours under AA: Alert body text (2.0–3.3), helper text (2.3), error helper text (2.3), Empty State description (3.5).
My callFigma stays the source of truth. Each finding is listed on the Token health page with a proposed fix, to change in Figma first.
Takeaway

A ramp is a set of rules, not a set of nice colours. Contrast is decided where the colour is defined.

2

Case study 2 of 5 · Typography

A responsive type system, built on five pillars

BetCan one set of style names, with a mobile and a desktop size, serve both platforms?

The five pillars, and what Nebula chose

Size, weight, line height and letter spacing depend on the typeface, so the family comes first.

FamilyManrope for the interface, Martian Mono for code. Product perception and brand start here.
SizeBody at 16 / 14 / 12px on desktop, 14 / 12 / 10px on mobile.
WeightRegular, medium, semibold and bold, set per style, not per screen.
Line height and spacingSet inside each style, so text keeps its breathing space wherever it's used.

Choosing the structure

Chose

Four groups (Display, Heading, Body, Label) plus Code, in mobile and desktop

Over

Two groups (heading, body) or three (heading, body, label)

Because

Three groups are the sweet spot for a single-platform app. Nebula serves phone and desktop, so it needs a display tier for large screens and a separate size for each platform.

74 styles

One name, two sizes

Named platform / group / style, so “body-b1” means the same role on a phone and a laptop.

Light bar: mobile · Dark bar: desktop · font size / line height in px

Checking it against the rules

Writing the rules next to the real values showed what to change in the next version.

Rule

Nebula today

ScaleFont size = base size × a multiplier: about 1.15–1.2 on desktop, 1.1–1.15 on mobile

Desktop headings step by a fixed 8px (24 → 32 → 40 → 48), so the ratio shrinks as sizes grow. A ratio scale would grow more evenly. Next version

Line heightTop headings 110–120%, body 130–150%, labels 120–140%

Body is 125% (16/20), a little tight for long reading, so the docs use 1.6 and propose a line-height/relaxed token.

ResponsiveKeep the hierarchy the same on both platforms; only the scale changes

Components step body and label text up by 2px from 768px. Headings stay, because desktop headings are about 1.5× larger and would break a component's proportions.

Takeaway

A type system is a structure first: decide how many tiers the platforms need, then the sizes.

3

Case study 3 of 5 · Tokens and variables

Naming every decision once

BetThree tiers, so one change in Figma reaches every component that uses it.

Two rules behind every token

DRY · Do not repeat yourself

One task, one way. Each property has only one unique way to be set.

In code it's the same rule: an inline style is a one-off; a class is reusable. Nebula styles components only with token classes.

Abstraction

Strip it down to the essentials

Take the customisation away and keep the base structure: height, width, size, space, colour. What's left is the product's core personality, and that core is what tokens store.

Why it mattersAbstraction is what makes theming possible: change the values, keep the structure, and the product gets a new identity.

One value, three names

Base holds the raw value. Semantic gives it a meaning. Component gives it a job. This is the real chain behind the primary button.

229base, also called primitive or global
237semantic, also called alias
339component: one decision per part
538typography, effects and grid

Naming rules I followed

Rule

In Nebula

VariableA bucket: a reusable way of storing a value and calling it again and again

color.surface.brand.primary.primary-bold is used, never #7033CC.

ChainingLink semantic variables to base ones, so a base change flows up

Every semantic and component token is a reference, not a copy of a value.

NamingAll lowercase, and the fewest variables that still give full control

Lowercase throughout. The trade-off: 339 component tokens give fine control but are a lot to maintain.

ExceptionsShadow, gradient and opacity don't have to come from variables

Shadows and focus rings are effect styles: 11 of them.

From Figma to code, automatically

No value is copied by hand. One command rebuilds the code from the Figma export.

Figma variables→JSON export→Style Dictionary→CSS variables+Tailwind theme→Components→Class audit

Chose

Deleting Tailwind's default colours and scales

Over

Adding Nebula's tokens next to them

Because

DRY again: with the defaults gone there is only one way to style. An off-system class like bg-blue-500 simply doesn't exist, and the audit fails if anyone tries.

Class audit: 0 off-system classes

When a token is missing

Some Figma values had no semantic token. Guessing a nearby one would hide the gap.

Token health page listing values waiting for tokens
InsteadEach raw value is written with a “TOKEN MISSING” note in the code. The Token health page lists all of them automatically: 30 today.
Proposedspacing/2 · spacing/10 · border-width · motion · logo colour · text medium · line-height relaxed
Takeaway

Name a decision once, and make every gap visible. Tokens are the system's memory.

4

Case study 4 of 5 · Component design and testing

Designing components as a blueprint for code

BetCan every Figma component match its code part for part, so design and development speak the same language?

Component architecture: a strategy, not a drawing

Architecture is how components are designed in Figma. It acts as a blueprint for developers and keeps design and code matched.

Property-basedOne component, many properties

Size, type and state as variants. Nebula's Button: 8 types × 4 sizes × its states.

Composition-basedBuilt from other components

Alert and Empty State use Button. Tag uses Badge for its count.

Chosen · hybridBoth, where each fits

Properties for what changes inside a component, composition for what it contains. This is what keeps it modular.

Naming components

Naming is a small science of signs. A name can describe how a component looks, what it does, or both.

Iconic · appearanceCircular Button, Pill Badge

Names the form. Breaks when the look changes.

Chosen · functionalButton, Alert, Empty State

Names the role. Stays true when the visual design changes, which a system will.

HybridCircular Submit Button

Clear and scalable for big libraries; more than Nebula needs today.

Building it in Figma: the property rules

Rule

In Nebula's components

OrderPut the most common properties first: dropdowns (size, type, state), then booleans, then text

Button in Figma: Type · State · Size, then Show Leading / Trailing / Loading Icon, then the two labels.

NamesBooleans start with “Show”, swaps and text with “Change”

Show Leading Icon, Show Helper Text, Change Label, Change Initials: 15 properties follow it.

Auto layoutThe outer frame hugs its content, inner parts fill the width; set min and max widths to stop unwanted resizing

The Button label truncates at a max width of 220px instead of stretching the button.

TextKeep one-line text to one line: truncate, max lines 1

Tag and Button labels truncate with an ellipsis.

Building it in code, with AI

I wrote the rules once as skills: a parent skill directs the work, and child skills each know how to do one job.

Figma link→Orchestrator→Component skill: how to build a good component→Token skill: how to apply tokens well→Cache
Reference folderBest practices the agents read before building, so every component starts from the same rules.
CacheA small, fast memory: the output of every successful build is saved and read first next time.
Review copiesProblems found in Figma become a “Proposed Improvements” copy, never a silent edit to the original.

Testing: four layers, three done

Most of a system's time goes into keeping it right, so checks are automated where possible.

  • Component statesEvery variant, size and state as a Storybook story: 60 stories
  • AccessibilityAn automated check on every story, plus keyboard and focus checked by hand
  • Cross-platformChecked at phone, laptop and full-HD widths; text adapts at 768px
  • Visual regressionNot done: no saved screenshots to compare after a change
Button docs page in Storybook
Handoff, on every docs page: design file link, interactions (states), accessibility and rationale (the Figma review).
Takeaway

A component is a contract between design and code. Its architecture, name and properties are the contract's wording.

5

Case study 5 of 5 · Strategy and governance

Design-system strategy for a team of one

BetWhich strategy fits a single-brand system with one maintainer and no product yet?

A design system follows the product, it doesn't lead it. We make design-system decisions because of the product.

So system designers are curators first and innovators later. This is Nebula's biggest limit: with no product yet, some of its decisions are educated guesses that a first real product would test.

Where Nebula is in its lifecycle

A healthy system loops. An unprotected one overloads, drifts apart, gets abandoned and is rebuilt.

Build→Use→Maintain→Reuse→Deprecate→Re-customise↺
Build→Use→Overload→Diverge→Abandon→Rebuildthe loop to avoid

Three choices

Chosen · typeSingle brand, one main library

Over multi-brand: a branded house (a main library with local ones) or a house of brands. One brand needs one source of truth.

Chosen · balanceConsistency first

Enterprise tools lean about 80% consistency, consumer apps about 60/40. A new system needs strict defaults before it can afford exceptions.

Chosen · governanceSolitary, with written rules

Over centralised (quarterly reviews) or federated (a community, every release). With one maintainer, the rules live in the docs and the audit.

How it stays protected

Token health

Every value without a token and every contrast finding, listed automatically from the code.

Docs site

Proposed Improvements

Contribution is open but governed: fixes go into a copy of the Figma component to review, never into the original.

Figma

Class audit

A check that fails if any class isn't a token. It runs on every component.

Code

How it would be adopted Untested · plan only

Talk to developers first and get the agreement in writing. Design adopts it first, then development.

Chose

Phased adoption: all new work uses the system, then existing screens move over feature by feature

Over

One shot: redesigning the whole product at once

Because

The system follows the product. Phases let each feature test the system, and the system improve in small releases. Then Educate, Engage, Evolve: teach it, work hands-on with designers, raise the bar.

Plan
Takeaway

Even alone, write the rules down. With one maintainer, the docs are the governance.

07 Documentation and usage

Two places to learn the system

Figma is the source of truth. The docs site explains how and why, and Storybook lets you try every state.

Colour foundation page
Docs site: foundations, a token explorer, and for each component its examples, anatomy, do's and don'ts, props, tokens, accessibility and Figma review.
Typography foundation page
One source: Storybook's descriptions and links come from the docs site's content, so the two never disagree.
08 Impact

What I can measure, and what I can't

No team uses Nebula yet, so I only claim what the files show.

0hard-coded colours in component code
0off-system classes (class audit)
30raw values flagged for new tokens
4component contrast findings documented
Not measured

Design speed with the library vs without it

Not measured

Developer speed and fewer review comments

Not measured

Fewer inconsistencies in a real product

09 Contribution

What I decided, and what AI built

I designed the system and made the calls. AI wrote most of the code, and I reviewed it.

I decided

  • The tokens, styles and components in Figma, and the three-tier structure
  • The skills' rules: how to build a component and how to apply tokens
  • Corrections where AI got it wrong: the tooltip triangle, the empty-state shadow, the avatar photo
  • Keeping component colours as in Figma: documented, not changed

AI built, from my rules

  • The Style Dictionary pipeline and the Tailwind theme
  • React components from my Figma links, through the orchestrator and its skills
  • The docs site, Storybook and the checks
  • Where it went wrong: mobile type on desktop, and turning every gradient purple when I asked for two
10 Reflection

What I learned, and what I'd do differently

Writing my rules next to the real values taught me the most.

LearnedComponents are infrastructure. Building them scalable and modular mattered more than any single screen.
LearnedFlag a gap; don't patch it. The “TOKEN MISSING” list turned into the next version's plan.
Next timeStart from a product. A system follows a product, and mine had to guess. I'd also use a ratio type scale and looser body line heights.
LimitSolo project: no team, no real product, no users yet.
LimitMost code is AI-generated. I reviewed and corrected it, but didn't write it line by line.
LimitNo visual regression tests; impact on speed is not measured.
11 Your turn

Explore Nebula

The live docs site, below. Storybook and the Figma file are one click away.

Open the docs site Open Storybook Open the Figma file