Skip to content

theme.json Reference

The theme.json file defines all design tokens for a theme. Each token maps to a CSS custom property used throughout the storefront.

Structure

json
{
  "colors": { ... },
  "fonts": { ... },
  "typography": { ... },
  "space": { ... },
  "breakpoints": { ... },
  "sizes": { ... },
  "radii": { ... },
  "shadows": { ... },
  "transitions": { ... },
  "components": { ... }
}

Colors

Semantic color tokens used by both DaisyUI and custom components.

TokenDefaultCSS VariableUsage
primary#111111--color-primaryPrimary brand color
accent#ff2d87--color-accentAccent / CTA color
success#10b981--color-successSuccess states
warning#f59e0b--color-warningWarning states
error#ef4444--color-errorError states
info#3b82f6--color-infoInformational states
text#111111--color-textPrimary text
textSecondary#6b7280--color-text-secondarySecondary text
textMuted#9ca3af--color-text-mutedMuted/disabled text
bg#ffffff--color-bgPage background
bgSubtle#f9fafb--color-bg-subtleSubtle background
bgMuted#f3f4f6--color-bg-mutedMuted background
border#e5e7eb--color-borderDefault borders
borderLight#f3f4f6--color-border-lightLight borders
overlayrgba(0,0,0,0.5)--color-overlayModal/drawer overlays

DaisyUI Color Mapping

Theme colors are mapped to DaisyUI's token system in uno.config.ts:

theme.jsonDaisyUI VariableDaisyUI Class
accent--color-primarybtn-primary, bg-primary
primary--color-secondarybtn-secondary, bg-secondary
success--color-successbtn-success, badge-success
error--color-errorbtn-error, alert-error

TIP

The accent color maps to DaisyUI's primary (the main CTA color), while the theme's primary maps to DaisyUI's secondary. This mapping ensures the most visually prominent UI elements use the accent color.

Fonts

TokenDefaultCSS Variable
sansSora, system-ui, sans-serif--font-sans
headingSora--font-heading
monoSF Mono, monospace--font-mono
googleFontsImportSora:wght@400;500;600;700;800N/A (generates @import)

Typography

TokenDefaultCSS Variable
baseFontSize15px--text-base-size
baseLineHeight1.6--text-base-leading
h1Size2.25rem--text-h1
h2Size1.75rem--text-h2
h3Size1.375rem--text-h3
h4Size1.125rem--text-h4
letterSpacing-0.01em--tracking
headingWeight700--font-weight-heading
bodyWeight400--font-weight-body

Space Scale

The space scale follows a 4px base unit. All values map to --space-{key} CSS variables.

TokenValueExample Usage
00p-0
px1pxborder-px
0.52pxgap-0.5
14pxp-1
28pxm-2
312pxp-3
416pxgap-4
624pxp-6
832pxm-8
1248pxpy-12
1664pxmt-16
2496pxmb-24

Sizes

TokenDefaultCSS Variable
headerHeight60px--header-height
headerHeightMobile56px--header-height-mobile
contentMax1320px--content-max
contentPadding20px--content-padding
inputHeight44px--input-height
buttonHeight44px--button-height
drawerWidth380px--drawer-width
sidebarWidth240px--sidebar-width

Radii

TokenDefaultCSS Variable
xs4px--radius-xs
sm6px--radius-sm
md8px--radius-md
lg12px--radius-lg
xl16px--radius-xl
2xl24px--radius-2xl
full9999px--radius-full

Shadows

TokenDefaultCSS Variable
xs0 1px 2px rgba(0,0,0,0.05)--shadow-xs
sm0 2px 4px rgba(0,0,0,0.06)--shadow-sm
md0 4px 12px rgba(0,0,0,0.08)--shadow-md
lg0 8px 24px rgba(0,0,0,0.12)--shadow-lg
xl0 16px 48px rgba(0,0,0,0.16)--shadow-xl

Transitions

TokenDefaultCSS Variable
fast120ms--transition-fast
base180ms--transition-base
slow280ms--transition-slow

Components

Override default radii and styles for specific component types:

json
{
  "components": {
    "buttons": {
      "borderRadius": "xl",
      "textTransform": "none",
      "padding": "12px 28px"
    },
    "cards": {
      "borderRadius": "md",
      "shadow": "none",
      "hoverShadow": "md"
    },
    "badges": {
      "borderRadius": "sm",
      "textTransform": "uppercase"
    },
    "inputs": {
      "borderRadius": "sm"
    }
  }
}

Source: theme.json