Carbonteq
Best Practices/Frontend

Design System Philosophy

Ever wondered how we keep everything looking so consistent? This guide dives into our Design System, showing you how we build scalable, maintainable products using design tokens, atomic utilities, and declarative variants.

Understanding Design Systems

Hey there! Ever wondered how we keep everything looking so consistent and feeling just right across all our products? That's where our Design System comes in! Think of it as our secret sauce – a single, trusty guide that brings together all the pieces our teams need to design, build, and develop amazing products. It's all about making sure everything looks like it belongs to the same family and gives you a smooth, unified experience, no matter which of our products you're using.

Key Principle: Visual Consistency

One of the coolest things about design systems is its focus on Visual Consistency. This simply means that every button, every input field, every little element should feel like it's part of the same team. It's like making sure all the puzzle pieces fit perfectly!

Why Do All Our Controls Feel So... Right?

You'll notice that all our buttons, input fields, and other interactive bits have the same comfortable height. No surprises there! This isn't by accident - when controls share the same height, everything just feels more polished and professional.

Inconsistent
Consistent

Our Colors Actually Work Together (Unlike That One Project...)

We've got a carefully chosen set of primary, secondary, and accent colors. We stick to these like glue to make sure our brand always shines through consistently. No more "let me just pick this slightly different shade of blue" moments!

Inconsistent
Consistent

The Magic of Consistent Shadows and Light

Even the way shadows fall and how light seems to hit our elements is consistent. This helps everything feel cohesive and makes it easy to understand what's important on the screen. It's like having the same lighting director for every scene in a movie.

Inconsistent
Consistent

Multi-Product Design System

Now, a regular design system might just focus on one product. But since we’re building a whole suite of awesome products, we need something a bit more powerful – a multi-product design system! This brings two super important things to the table:

  1. Themeability
    Imagine being able to give different products their own unique look and feel, even if they’re built with the same core components. That’s themeability! It lets us differentiate brands while keeping the underlying structure and interactions familiar.

  2. Extensibility
    Our products are always growing and evolving, and our design system needs to keep up! Extensibility means we can easily tweak existing elements or add brand new ones without breaking anything. It’s built to grow with us!

Design Tokens: The Building Blocks

Think of Design Tokens as the tiny, powerful building blocks of our design system. They’re basically named little containers that hold design decisions—like a specific color code (#FFDF38) or a font size (16px). They’re like “configurable knobs” that let us manage and update design properties in a super organized way.

1. Raw Values

#FFDF38

Core values, ready for use

These are the most basic, no-frills values. Just the literal hex code or pixel value, without any special meaning yet.

2. Semantic Scale

yellow-100

Also referred to as primitive or base tokens

These tokens are meant to replace the raw values with semantic scale values which are easier to understand and use.

3. Integration Tokens

link-color-default

Semantic tokens bringing consistency

These tokens apply semantic values across contexts to ensure consistency throughout the UI.

4. Component-Level Tokens

button-bg-primary

Building blocks of extensions in the current system

These tokens define component-specific extensions, allowing for flexible customization of individual UI components.

Need for a semantic scale: Numbers fail us

The fundamental issue lies in how we approach CSS architecture. Historically, styling methodologies have been divided into two distinct camps: visual hierarchy approaches that use descriptive class names like .text-red { color: red; }, and semantic hierarchy approaches that use meaningful names like .error { color: red; }. Each methodology offers compelling benefits, yet neither alone addresses the full spectrum of challenges teams face when building scalable design systems.

The Problem: Arbitrary Font Sizes
Using random pixel values for text breaks visual hierarchy and rhythm. Can you make these two headings feel like they belong together?

Developer A's Heading

Developer B's Heading

The Solution: A Typographic Scale
Semantic tokens like `text-xl` are easier to remember than arbitrary pixel values, leading to consistent choices across your team and better design outcomes.

Heading with a Token

Another Heading with a Token

Implementation in Pallas UI

In our Pallas UI library, we use Panda CSS to make our design token strategy a reality. It aligns perfectly with how we’ve layered our tokens:

Semantic Scale (Foundation Tokens)

Our foundation tokens are the backbone of our design system, set up in Panda CSS to represent core design values like color and spacing (e.g., colors.yellow.100). These tokens ensure a consistent visual language and are often used alongside atomic utility classes for rapid, reliable styling.

Atomic Utilities

Atomic utilities are single-purpose classes generated from our design tokens. They let developers quickly compose complex interfaces while staying true to the design system. By using only what’s needed, we keep our CSS lean and our UI consistent, making development both fast and predictable.

Example: Atomic Utilities

import { css, cx } from '../styled-system/css'
// Single-purpose utilities
export const textPrimary = css({ color: 'primary.500' })
export const bgRed = css({ bg: 'red.500' })
export const p4 = css({ p: 'layout.md' })
// Compose utilities
<div className={cx(bgRed, p4, textPrimary)}>
Styled with atomic utilities
</div>
// Or compose directly
export const errorCard = css({
bg: 'red.500',
p: 'layout.md',
color: 'white',
rounded: 'md'
})

Visual Consistency (Integration Tokens)

To keep things looking sharp and cohesive, we use semantic tokens that reflect our design choices. These tokens, which are part of our “Integration Tokens” layer, follow a clear Category-Item-Type naming convention (like color.background.primary), making our design language easy to understand and apply.

Spacing and Sizing: The Foundation of Layout Consistency

Consistent layouts are crucial, but getting them right can be a real time-sink. That’s why we use a complete system for spacing and sizing tokens. Instead of guessing at pixel values, our developers can pull from a ready-made set of tokens for control heights, layout spacing, component gaps, and padding. This cuts down on decision-making, speeds up development, and guarantees our entire app feels visually unified.

1
Layout Spacing Foundation

Start with page-level spacing that establishes consistent layout patterns across your application.

2
Component Internal Spacing

Add component-level spacing for consistent internal relationships within UI elements.

3
Section-Level Spacing

Complete the system with section-level spacing for major content breaks and page sections.

4
Control Heights and Sizing

Add standardized component heights and sizing tokens for consistent UI elements.

5
Self-Documenting Usage

With the complete token system in place, usage becomes semantic and self-documenting.

// panda.config.ts
import { defineConfig } from '@pandacss/dev'
export default defineConfig({
theme: {
extend: {
tokens: {
spacing: {
layout: {
xs: { value: '8px' }, // Tight layout spacing
sm: { value: '16px' }, // Standard layout spacing
md: { value: '24px' }, // Medium layout spacing
lg: { value: '32px' }, // Large layout spacing
xl: { value: '40px' } // Extra large layout spacing
}
}
}
}
}
})

References: Pallas UI Spacing & Sizing Documentation, W3C Design Tokens Format, Panda CSS Tokens

Component Design (Declarative Approach)

When it comes to styling components and their variations, we favor a declarative approach that keeps our code clean and maintainable. Instead of drowning in component-specific tokens, we use variants APIs, like those in Panda CSS recipes. This method, part of our “Component-Level Tokens” layer, makes managing different styles for the same element much tidier.

Benefits of Declarative Variants

Don't

Create unique tokens for each component variant. This approach:

  • Leads to token proliferation across components
  • Creates maintenance complexity with duplicate values
  • Makes consistency difficult to achieve
  • Requires separate token sets for each component
DoClick to view

Create variants using base tokens in a declarative manner. This provides:

  • Token Efficiency: One set of base tokens serves all components
  • Consistent Scaling: Size variants use the same semantic spacing
  • Maintainable: Changes to base tokens propagate automatically
  • Declarative: Variant selection is based on props, not custom tokens
// Traditional approach - component-specific tokens
const tokens = {
button: {
primary: {
bg: '#3b82f6',
color: '#ffffff',
padding: '8px 16px'
},
secondary: {
bg: '#f8fafc',
color: '#1e293b',
padding: '8px 16px'
}
},
card: {
default: {
bg: '#ffffff',
border: '#e2e8f0',
padding: '16px'
},
elevated: {
bg: '#ffffff',
border: '#e2e8f0',
shadow: '0 4px 6px -1px rgb(0 0 0 / 0.1)',
padding: '16px'
}
}
}
// Problem: Token proliferation and duplication
// Each component needs its own token set
// Hard to maintain consistency across components

Using variants turns our static style definitions into a dynamic component API. This allows developers to build flexible interfaces that adapt to different needs while upholding our design principles. The approach is more efficient, as a single set of base tokens serves all components, and any changes automatically propagate everywhere. It's a declarative system that makes styling predictable and consistent across the board.

References: Pallas UI Theming

Big Wins: What You Get with Our Design System

Supercharging Developer Experience

Don't

Use arbitrary numerical values without context. This creates:

  • Cognitive overhead for developers remembering what values mean
  • Questions about appropriate usage in different contexts
  • Inconsistent spacing decisions across team members
  • Difficulty communicating about spacing intent
DoClick to view

Use semantic tokens that communicate intent clearly. This provides:

  • Cognitive Load Reduction: Semantic tokens reduce mental overhead
  • Intuitive Usage: Token names guide correct application
  • Self-Documenting Code: Spacing intent is clear from token names
  • Faster Onboarding: New developers understand spacing context immediately
// Traditional approach - cognitive overhead
import { css } from '../styled-system/css'
const containerStyle = css({
padding: '4', // What does '4' mean? Layout or component spacing?
margin: '6', // Why '6'? How does it relate to other spacing?
gap: '3' // Is '3' appropriate for this context?
})
const buttonStyle = css({
paddingX: '5',
paddingY: '2',
bg: 'blue.600', // What exact blue shade is this?
_hover: {
bg: 'blue.700' // Is this hover shade consistent with our brand?
}
})
// Questions developers ask:
// - What does padding: '4' mean? Layout or component spacing?
// - Why margin: '6'? How does it relate to other spacing?
// - Is gap: '3' appropriate for this context?
// - What exact blue shade is bg: 'blue.600'?
// - Is the hover shade consistent with our brand?

Our semantic design system is a game-changer for developers! It makes coding faster and more reliable by offering awesome benefits like compile-time validation, smart autocomplete for tokens, and optimized CSS bundles for top-notch performance. Plus, it boosts teamwork by providing consistent APIs across our codebase, making it super easy for new team members to jump in and get productive quickly. No more guessing—just clear, predictable interfaces and well-defined rules!

Streamlined Design Workflow

Our design system bridges the gap between design and development, creating a seamless workflow. Design tokens allow designers in Figma and developers on the code to collaborate in real-time. When design decisions evolve, our systematic approach ensures those updates are consistently reflected everywhere. Designers love the creative freedom within consistent constraints, and design reviews become much smoother with our unified system.

Boosting Organizational Efficiency

Our design system brings big efficiency gains to the whole organization. We cut down on repetitive development work, deliver features faster, and keep our brand consistent across the board. Teams can focus on exciting new features instead of constantly rebuilding basic styles, and marketing can roll out brand updates effortlessly thanks to centralized control. Ultimately, it leads to a better, more consistent user experience for everyone.

Wrapping Up

We truly believe that the future of scalable design lies in systematic approaches that bring design and development closer through smart token systems, layered architectures, and consistent APIs. Pallas UI's innovations—especially our semantic spacing tokens and declarative variants—are a huge leap forward in how we build design systems.

By embracing design systems that go beyond just colors and typography to include semantic spacing and layout tokens, our teams can dramatically speed up layout decisions while making sure everything looks consistent. And our declarative approach to variants helps us avoid token clutter while staying super flexible.

This systematic approach transforms layout from a tricky, time-consuming task into a fast, consistent process. It frees up our teams to really focus on solving unique business problems instead of reinventing the wheel on foundational design patterns. As our applications grow and our teams expand, Pallas UI's semantic approach becomes absolutely essential for keeping our development pace high and our design quality top-notch.

The examples throughout this guide show exactly how these ideas work in practice, highlighting the real-world benefits:

  • Less mental load with clear, semantic naming
  • Self-documenting code that tells you what it does
  • Consistent look and feel across all components
  • Easy composition using our foundational tokens

References: Pallas UI Documentation, Panda CSS Documentation