Design Tokens and Variables in shadcncraft

Understand how design tokens and variables power theming in shadcncraft. Learn how to manage colors, spacing, typography, and layout tokens in Figma.

PreviousNext

Collections

Variables are grouped into four collections, each handling a specific part of your design system.

Variables collections

1. Primitives

This collection includes standard Tailwind utility-based values. It's designed to match the utility-first approach used in shadcn/ui.

Use these variables to:

  • Set component dimensions (height, width) and spacing
  • Define borders, including radius and stroke width
  • Adjust opacity values
  • Set line-height for text styles
GroupUsage
border-radiusBorder radius values for rounded corners
border-widthSet border thickness
heightControl the height of components and individual elements
max-widthSet minimum and maximum width constraints for components or individual elements
opacityAdjust element transparency
widthControl the width of components and individual elements

2. Theme

Edit these variables to apply your brand styling. This is where the majority of the theming variables live for light and dark mode in shadcncraft. The Theme collection allows you to house multiple brands with unique styling from the one library.

Use these variables to define theme-specific:

  • Spacing
  • Typography
  • Shadows
  • Radii
GroupUsage
colorsDefine the color palette used for your theme
customMisc things like icon border width
fontControl all the facets of typography including family, size and weight
radiusTheme-specific radii – references Primitive collection
shadowDefine all the properties of the various shadows

Color variable usage guide

colorUsage
primaryDefine the color palette used for your theme
primary-foregroundFor elements on top of primary
secondaryYour secondary brand color
secondary-foregroundFor elements on top of secondary
accentHighlight color for active or focused elements
accent-foregroundFor elements on top of accent
backgroundMain application background color
foregroundFor elements on top of background
cardBackground color for cards
card-foregroundFor elements on top of card
popoverBackground color for things like select menus
popover-foregroundFor elements on top of popover
mutedSubtle background for elements requiring less attention
muted-foregroundFor elements on top of muted
destructiveFor errors and destructive actions like delete
destructive-foregroundFor elements on top of destructive
borderMain border color
inputBorder color for form input elements
ringHelps define the focus indicator
opacity-90Applied to elements to lighten their background color
opacity-50Applied to elements to lighten their background color
opacity-30Applied to elements to lighten their background color
custom/focusThe soft outer focus ring on focussed elements like buttons
custom/destructive-focusThe soft outer focus ring on focussed elements like destructive buttons
bg-input-30Used for the background of elements like input to increase contrast in dark mode. More info here
bg-input-50Used in the backgrounds of elements on hover like Combobox
bg-input-80Used for input element background like Switch

3. Mode

These are the colors you apply to elements in your library. They enable the use of light and dark modes. These reference variables in the Theme collection.

GroupUsage
RootThe majority of colors for UI in shadcncraft. These reference colors in the theme collection.
customFigma-specific colors used to achieve the shadcn/ui look.
chartColors used for charts
shadowColors used for shadows
sidebarColors specific for the sidebar component

4. Pro

These are variables specific to the Pro Figma UI Kit only.

GroupUsage
grid/marketingSemantic variables to handle spacing across all marketing blocks
grid/applicationSemantic variables to handle spacing across all application blocks

Best practices

  • Use variables instead of hard-coded values to maintain consistency across your designs.
  • Apply Mode variables to any elements that need to respond to light or dark themes.
  • Use the collections in different ways:
    • Alter the values of Theme for Theme-specific styles
    • Apply mode variables rather than editing their values

Following these practices ensures your Figma designs stay aligned with the shadcn/ui framework and are easily translatable to Tailwind CSS in code.

SBIOTJ

Join 3,000+ builders shipping with shadcncraft

Design and assemble full pages faster with production-ready blocks built for real products.

  • Production-ready blocks and components
  • Clean React and Tailwind parity
  • Built for SaaS, marketing, and ecommerce teams
Get the design system
Join Now CTA

Real support from the team behind shadcncraft

Get help within 24 hours from the people who build and maintain the system.

Email
Prefer a direct line? Send us a message and we'll get back to you as soon as possible.
Discord
Get quick support, share feedback, or connect with other builders.
Feedback
Got something to say about anything shadcncraft? We'd love to hear it.