How to design a UI kit foundation: tokens, states, and component contracts

From foundations to components: clear token roles, predictable states, and contracts engineers can implement.

How to design a UI kit styleguides: tokens, states, and component contracts
Design & Code

Published on

February 9, 2026

|

8 min read

Tutorials

How to design a UI kit styleguides: tokens, states, and component contracts

Navigation

Subscribe to new posts

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

By subscribing you agree to with our Privacy Policy.

Share this post

Author image

Roman Kamushken

A UI kit becomes valuable when it removes ambiguity.

Developers want predictable APIs and stable styling hooks.
Product managers want fewer regressions and faster iteration.
Design system architects want a component library that scales across teams, themes, and releases.

This post is an engineering-style guide to building a production-ready UI kit foundation for a SaaS UI kit or enterprise UI kit.

By the end, you will have four concrete artifacts you can ship as part of your design system architecture:

➀ A design tokens model with a naming convention that supports theming and dark mode
➁ A shared UI component states matrix for core controls
➂ A component contract template, plus two filled examples you can copy into docs or Storybook
➃ A Figma component library structure that maps to real implementation constraints

How to design a UI kit foundation: tokens, states, and component contracts
How to design a UI kit foundation: tokens, states, and component contracts. A product UI style guide sample fully generated by Venice.AI - a handy tool for not only designers & vibe coders.

Scope and terminology

A short alignment saves weeks later.

Style guide
→ visual rules and primitives: color ramps, typography scale, spacing, elevation, borders, icon rules
→ the “grammar” that components inherit

UI kit
→ reusable UI components: buttons, inputs, navigation, feedback, overlays, data display
→ variants, states, and usage patterns

Design system
→ operating model around the library: governance, contribution workflow, versioning, documentation, QA practices

This guide focuses on UI kit foundation work that directly impacts implementation speed, consistency, and long-term maintainability.

Start with interface grammar before components

If you build UI components first, you freeze hidden decisions inside each component. Later you discover five paddings, three baselines, and inconsistent focus styling.

Interface grammar is a small set of constraints that every component uses.

Spacing scale and layout rhythm

Choose one spacing system and treat it as an API, not a suggestion.

❶ Pick a base step (4 or 8 is common)
❷ Define a finite set of spacing tokens derived from it
❸ Define where exceptions are allowed and what approves them
❹ Define vertical rhythm rules for forms, tables, and dense screens

A practical spacing token set for a UI kit foundation:

· space.1 = 4
· space.2 = 8
· space.3 = 12
· space.4 = 16
· space.6 = 24
· space.8 = 32
· space.10 = 40

These values are less important than two properties:

→ the set is small
→ components stick to the set

☞ If your product includes admin screens or data-heavy views, define density rules now. Dense enterprise UI forces spacing exceptions later unless you plan for it.

Control heights, hit targets, and baselines

Developers will implement these as constants. Make them explicit.

❶ Define control heights as tokens (S, M, L)
❷ Define minimum hit targets where touch matters
❸ Define baseline alignment rules for label, value, and helper text
❹ Define icon sizes and baseline alignment relative to text

Example control sizing tokens:

· control.height.s = 32
· control.height.m = 40
· control.height.l = 48

And the rule that prevents layout drift:

→ the text baseline aligns across inputs, selects, and buttons for the same size preset

☞ Baseline alignment becomes visible only when you assemble real forms. Test with long labels, helper text, and mixed icon presence.

Radius, borders, and elevation

Small sets scale. Large sets fragment.

❶ Pick 2 to 4 radii values
❷ Map each radius to a UI meaning
❸ Define border roles as tokens
❹ Define elevation levels and which components may use them

Example radii mapping:

· radius.1 for small controls (chips, toggles)
· radius.2 for inputs and buttons
· radius.3 for cards and panels
· radius.4 for modals and large surfaces

Elevation levels that remain implementable:

· elevation.0 canvas and flat surfaces
· elevation.1 raised card, subtle hover lift
· elevation.2 popovers and dropdown menus
· elevation.3 modal dialogs

☞ Use borders and elevation together. In many SaaS UI kits, a subtle border plus a mild shadow reads cleaner than heavy shadows.

What to verify early

These checks catch most “foundation drift” before the component library grows.

❶ Place a button, input, select, and icon button on one row for each size preset
❷ Add label and helper text under the input and select
❸ Toggle hover and focus styles
❹ Confirm there is no layout shift across states and sizes

This single assembly is a fast quality gate for a UI kit foundation.

How to design UI kit styleguides: Start with interface grammar before components
Start with interface grammar before components

Design tokens that survive theming, dark mode, and scale

Design tokens are the contract between visual intent and implementation.

If tokens are treated as palette names, theming becomes fragile.
If tokens are treated as semantic roles, theming becomes mapping.

A scalable token system uses three layers:

Primitive tokens (raw ramps and constants)
Semantic tokens (meaningful roles)
Component tokens (targeted overrides under strict rules)

Primitive tokens

Primitive tokens represent raw values. Keep them stable and descriptive.

· color.neutral.0 … color.neutral.900
· color.accent.100 … color.accent.900
· color.success.*, color.warning.*, color.danger.*
· opacity.*
· shadow.* (if you store shadow primitives)

Primitive tokens should rarely appear in component styles directly.

Semantic tokens

Semantic tokens represent UI roles. This is where your design system architecture gets leverage.

Examples that cover most UI kits:

· text.primary, text.secondary, text.muted, text.inverse
· bg.canvas, bg.surface, bg.surfaceRaised
· border.default, border.subtle, border.divider
· accent.primary, accent.primaryHover, accent.primaryPressed
· selection.bg, selection.text
· focus.ring, focus.ringInner
· state.success, state.warning, state.danger

The key property:

→ semantic token names remain identical across themes
→ only the mapping changes

☞ If you want reliable dark mode, build it as a semantic token mapping problem. This avoids maintaining two parallel UI kits.

Component tokens under strict rules

Component tokens are justified when semantic roles cannot express a repeated visual requirement.

Use a clear threshold so token sprawl is controlled:

❶ Introduce a component token only if the exception repeats on at least 3 key screens or appears in at least 2 different components
❷ Tie the component token to a stable UI meaning, not a one-off layout
❸ Document where it is allowed and where it is forbidden
❹ Ensure the token works under theming without manual fixes

Examples:

· table.header.bg
· table.row.hover.bg
· toast.bg (if it differs from normal surfaces)
· input.border.error (when the error behavior is standardized)

☞ If a designer wants a one-off treatment for a single screen, treat it as a screen style decision, not a design token decision.

Token naming convention

A naming convention is part of your UI kit foundation. It impacts discoverability and the ability to automate.

A practical structure:

→ primitives: color.<family>.<step>
→ semantics: <category>.<role>[.<state>]
→ components: <component>.<part>[.<state>]

Examples:

· color.neutral.700
· bg.surfaceRaised
· text.primary
· accent.primaryHover
· button.bg.pressed
· input.border.focus
· select.option.bg.highlighted

This is readable for engineers and stable for design systems.

A small, implementation-ready token excerpt

This is the level of specificity developers expect when building a component library.

{
  "color": {
    "neutral": { "0": "#FFFFFF", "900": "#0B0F14" },
    "accent": { "600": "#2563EB", "700": "#1D4ED8" },
    "danger": { "600": "#DC2626" }
  },
  "semantic": {
    "bg": {
      "canvas": "{color.neutral.0}",
      "surface": "{color.neutral.0}",
      "surfaceRaised": "{color.neutral.0}"
    },
    "text": {
      "primary": "{color.neutral.900}",
      "secondary": "{color.neutral.900}",
      "muted": "{color.neutral.900}"
    },
    "border": {
      "default": "{color.neutral.900}",
      "subtle": "{color.neutral.900}"
    },
    "accent": {
      "primary": "{color.accent.600}",
      "primaryHover": "{color.accent.700}"
    },
    "state": {
      "danger": "{color.danger.600}"
    }
  }
}

The exact colors will differ by brand. The structure scales.

☞ If you plan to connect tokens to code, keep the token tree stable and avoid frequent renames. Versioning design tokens is harder than versioning components.

Design tokens that survive theming, dark mode, and scale
Design tokens that survive theming, dark mode, and scale

Color rules that remain readable under real data

Color problems in a UI kit usually come from missing state rules and missing surface rules.

Neutral ramp strategy

A neutral ramp must support four distinct tasks:

· readable text across surfaces
· subtle borders and dividers
· elevation separation
· disabled and muted content

A frequent failure in enterprise UI is using the same neutral for text and borders across every surface. This reduces hierarchy and makes tables hard to scan.

☞ Validate your neutral ramp using actual components, not swatches. Put neutrals under text, inside tables, inside modal overlays, and inside dropdowns.

Accent behavior across states

Define state deltas, then implement them consistently across the component library.

❶ Default uses accent.primary
❷ Hover uses accent.primaryHover
❸ Pressed uses accent.primaryPressed
❹ Focus uses focus.ring and focus.ringInner, not ad hoc styling
❺ Disabled has no hover and no pressed behavior

Then apply the same logic to secondary and ghost variants.

☞ The UI component states matrix must avoid layout shifts. Colors and shadows can change, padding and border widths should remain stable.

Status and semantic meaning

Status colors need both foreground and background roles, especially for alerts, badges, and form errors.

Define pairs:

· danger.fg, danger.bg, danger.border
· success.fg, success.bg, success.border
· warning.fg, warning.bg, warning.border

Then map them to component parts:

→ input.border.error = danger.border
→ input.helper.error = danger.fg
→ alert.danger.bg = danger.bg

☞ Use status with redundancy in critical flows. Combine color with icon and text, and define where status messaging lives so it does not jump layouts.

Theming and dark mode parity

Dark mode fails when the token model duplicates intent.

A stable approach:

❶ Keep semantic token names identical
❷ Map semantic tokens to theme-specific primitives
❸ Validate contrast and hierarchy using the same component assemblies in both themes
❹ Confirm selection, focus, and error treatments remain recognizable

This is the difference between “dark UI kit” as a duplicate design and “theming” as a controlled mapping.

UI kit design style guides: Color rules that remain readable under real data
Color rules that remain readable under real data

To be continued tomorrow...

Share this post

Subscribe to Setproduct

Once per week we send a newsletter with new releases, freebies and blog publications
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

By clicking Sign Up you're confirming that you agree with our Terms and Conditions.

Congratulations!

You're in! Expect awesome updates in your inbox

FAQs

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique.
No items found.

Our Dashboard Templates Will Make It A Treat To View Data

Experience the magic of data visualization with our user-friendly dashboard templates. Try out our dashboards now and enjoy efficient reporting processes, greater transparency in, among others monitoring and making educated decisions easily.
Nocra UI kit

Nocra UI kit

Nocra is a design system for AI products. Built specifically for startups harnessing AI generation: images, video, audio, music, prompts, and beyond.

Material X for Figma

Material X for Figma

Figma library with 1100+ components & 40 app templates beyond Material Design. Powered by top-notch shapes and Manrope font. Customizable & Adjustable UI kit now available for Angular & Figma

Material You UI kit

Material You UI kit

Figma & React library with 2600+ variants of 32 components compatible with Material Design 3. Plus 220+ dashboard templates for all the viewports. Now available for NextJS & TailwindCSS.

Figma React UI kit

Figma React UI kit

Designed and well-organized in Figma React-based UI toolkit for the web. Optimized for building complex data-dense interfaces for desktop and mobile applications.

Panda Design System

Panda Design System

Figma library with dashboard, calendar, kanban, profile, table, ecommerce and 80+ templates in total. Components with variants, dark theme included.

Eclipse UI kit

Eclipse UI kit

Figma library with 1100+ components & 74 templates for data-driven web applications. Powered by auto-layout. Supercharged by Figma's variants.

Rome UI kit for Figma

Rome UI kit for Figma

Customizable and well-organized team library. Contains 250+ components & 30 web app templates powered by stylish and trendy guidelines.

Material Design System

Material Design System

Figma library is based on 100% guidelines compliance with Material.io. Contains ready‑to-use templates to accelerate app UI design.

Neolex Dashboard UI kit

Neolex Dashboard UI kit

Customizable & adjustable dashboard design system with 50+ ready-to-use app layouts, 1900+ variants for 30 components with auto-layout.

Material Desktop Dashboard UI kit

Material Desktop Dashboard UI kit

Figma library with 48+ dashboard templates based on reusable desktop app patterns carefully handpicked from the most popular web apps.

Xela UI kit for Figma

Xela UI kit for Figma

Figma library with 1900+ variants of 30 components categories to craft perfectly shaped desktop & mobile apps. Customizable & Adjustable dashboard design system with 50+ web app templates.

Figma S8 Design System

Figma S8 Design System

Figma design library for mobile and desktop apps made of high quality styled components. Full version includes 67 dashboard templates.

OE Figma Design System

OE Figma Design System

Customizable and well-organized Figma library. This design system aimed to build highly loaded interfaces, boost the speed and save more costs.

Related posts

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Design & Code

6 min read

Mastering JavaScript: Essential JavaScript Tricks and Tips For Web Developers

Discover essential JavaScript tips for web developers, covering key functions, front-end and back-end development, cross-platform applications, and productivity tools. Stay ahead with the latest JavaScript insights and enhance your coding skills.

Design & Code

5 mins read

Checkbox UI design – React component styled in Chakra

Discover stylish design ideas and code samples for a React checkbox component, designed in Figma and styled in Chakra. Get inspiration and live components to improve your UI design

Design & Code

2 mins read

9 reasons to use Material UI kit for Next.js, TailwindCSS and Figma

Discover the 9 reasons why our Figma & Next.js library is the best choice for web applications, especially when styled with the trendy Material You design theme.

Figma Templates & UI kits

Save time and human resources by reusing hundreds of pre-made templates crafted by us. Based on top notch UX taken from the World's best apps.

Nocra UI kit

Nocra is a design system for AI products. Built specifically for startups harnessing AI generation: images, video, audio, music, prompts, and beyond.

Material X for Figma

Figma library with 1100+ components & 40 app templates beyond Material Design. Powered by top-notch shapes and Manrope font. Customizable & Adjustable UI kit now available for Angular & Figma

Material You UI kit

Figma & React library with 2600+ variants of 32 components compatible with Material Design 3. Plus 220+ dashboard templates for all the viewports. Now available for NextJS & TailwindCSS.

Figma React UI kit

Designed and well-organized in Figma React-based UI toolkit for the web. Optimized for building complex data-dense interfaces for desktop and mobile applications.

Panda Design System

Figma library with dashboard, calendar, kanban, profile, table, ecommerce and 80+ templates in total. Components with variants, dark theme included.

Eclipse UI kit

Figma library with 1100+ components & 74 templates for data-driven web applications. Powered by auto-layout. Supercharged by Figma's variants.

Rome UI kit for Figma

Customizable and well-organized team library. Contains 250+ components & 30 web app templates powered by stylish and trendy guidelines.

Material Design System

Figma library is based on 100% guidelines compliance with Material.io. Contains ready‑to-use templates to accelerate app UI design.

Neolex Dashboard UI kit

Customizable & adjustable dashboard design system with 50+ ready-to-use app layouts, 1900+ variants for 30 components with auto-layout.

Material Desktop Dashboard UI kit

Figma library with 48+ dashboard templates based on reusable desktop app patterns carefully handpicked from the most popular web apps.

Xela UI kit for Figma

Figma library with 1900+ variants of 30 components categories to craft perfectly shaped desktop & mobile apps. Customizable & Adjustable dashboard design system with 50+ web app templates.

Figma S8 Design System

Figma design library for mobile and desktop apps made of high quality styled components. Full version includes 67 dashboard templates.

OE Figma Design System

Customizable and well-organized Figma library. This design system aimed to build highly loaded interfaces, boost the speed and save more costs.

Figma iOS kit

Figma library of iOS patterns served as ready-made templates. This UI kit inspired by World's best apps. Based on Human Interface guidelines.

Figma S8 Design System

Figma design library for mobile and desktop apps made of high quality styled components. Full version includes 67 dashboard templates.

Most iOS UI kit for Figma

iOS native components and app templates organized into a «Most Design System» fully compatible with Apple's Human Interface guidelines.

Rome UI kit for Figma

Customizable and well-organized team library. Contains 250+ components & 30 web app templates powered by stylish and trendy guidelines.

Material Design System

Figma library is based on 100% guidelines compliance with Material.io. Contains ready‑to-use templates to accelerate app UI design.

Nucleus UI

Nucleus UI contains 1000 components and variants with 500+ mobile screens designed for Figma (including 9 themes from Event, E-commerce, Finance, NFT, etc.).

Figma Android UI kit

Components-driven Android mobile UI library for Figma. Consists of 140 high quality application templates made of total 250+ UI components.

Mobile X UI kit

Customizable & adjustable iOS / Android design system loaded with ready-made 157 app templates based on 860+ variants for 20 components.

Appka iOS UI kit

Customizable & adjustable iOS design system with 4100+ variants for 28 components and 280+ ready-to-use app layouts crafted for Figma.

Full iOS UI kit

Customizable iOS design system with 320 ready-to-use app layouts. You can modify them or use as it is to save time and never design from scratch again.

Xela for Flutter

XelaUI for Flutter is a simple, modular and accessible component library that gives you the building Flutter apps for mobile and desktop.

Xela for Android

Ready-made collection of fully customizable widgets, UI screens and reusable components for Android coded with Jetpack Compose.

Xela for Swift

Designed for iOS Developers. We provide fully coded customizable components, widgets and well-organized iOS screens for Figma & SwiftUI.

Material You UI kit

Figma & React library with 2600+ variants of 32 components compatible with Material Design 3. Plus 220+ dashboard templates for all the viewports. Now available for NextJS & TailwindCSS.

Figma Charts UI kit

Components-driven graphs design kit for dashboards, presentations, infographics & data visualisation. Includes 25+ charts types for all the viewports.

Hyper Charts

Create impressive visuals with Figma's graphs templates – dozens of scalable and customizable data visualization blocks for dark and light modes.

Orion UI kit

Figma library with 40+ full-width charts templates served in light & dark themes. Contains 200+ of dataviz widgets that look perfect on desktop & mobile screens.

Xela for React

React based components library for beautiful user interface in React apps. Lightweight library for your projects. Contains pre-made web app templates.

Figma React UI kit

Designed and well-organized in Figma React-based UI toolkit for the web. Optimized for building complex data-dense interfaces for desktop and mobile applications.

Material X for Figma

Figma library with 1100+ components & 40 app templates beyond Material Design. Powered by top-notch shapes and Manrope font. Customizable & Adjustable UI kit now available for Angular & Figma

Xela for Flutter

XelaUI for Flutter is a simple, modular and accessible component library that gives you the building Flutter apps for mobile and desktop.

Xela for Android

Ready-made collection of fully customizable widgets, UI screens and reusable components for Android coded with Jetpack Compose.

Xela for Swift

Designed for iOS Developers. We provide fully coded customizable components, widgets and well-organized iOS screens for Figma & SwiftUI.

Material You UI kit

Figma & React library with 2600+ variants of 32 components compatible with Material Design 3. Plus 220+ dashboard templates for all the viewports. Now available for NextJS & TailwindCSS.

Xela for React

React based components library for beautiful user interface in React apps. Lightweight library for your projects. Contains pre-made web app templates.

Levitate 3D kit for Figma

Components-driven 3D kit to design eye-catching Figma presentations. Helps to enhance your landing page, product or app, brand ident, etc.

Website templates UI kit

Landing pages reusable templates kit based on most effective web design patterns. 140+ dark & light constrained design blocks.

Figma Landing Pages UI kit

Landing pages templates library based on constrained & organized components aimed to speed-up the production of effective websites.

Zeus UI kit

Create hassle-free landing pages in Figma. This kit is based on 10 landing page templates, powered by 1600+ variants for 630+ web blocks.

This is some text inside of a div block.
This is some text inside of a div block.