Design System
Makes your components look like they belong in Salesforce. Handles colors, spacing, and fonts automatically.
Skill Details
Install this skill
Works with
Generate Lightning Web Components that are fully compliant with SLDS 2 (Salesforce Cosmos theme). All styling must use global styling hooks (--slds-g-) — never hardcoded values.
Core Rules
--slds-g- CSS custom properties** for colors, spacing, sizing, typography, shadows, and radiivar() for resiliencelightning- base components** over custom HTML where availableSLDS 2 Architecture
SLDS 2 decouples structure (layout, spacing) from visual design (colors, radii, shadows). This enables theme switching (light/dark/custom) without component changes.
┌─────────────────────────────────────────┐ │ Theme Layer (Cosmos, custom, dark) │ --slds-g-color-*, --slds-g-shadow-* ├─────────────────────────────────────────┤ │ Structure Layer (layout, spacing) │ --slds-g-spacing-*, --slds-g-sizing-* ├─────────────────────────────────────────┤ │ Component Layer (lightning-*, LWC) │ Consumes hooks, never overrides them └─────────────────────────────────────────┘
Global Styling Hooks Reference
Surface Colors
Use for backgrounds, text on backgrounds, and borders of content areas.
| Hook | Purpose | Example Use | ||
|---|---|---|---|---|
--slds-g-color-surface-1 | Primary background | Page/card background | ||
--slds-g-color-surface-2 | Secondary background | Nested card, sidebar | ||
--slds-g-color-surface-3 | Tertiary background | Hover row highlight | ||
--slds-g-color-surface-container-1 | Container background | Outer wrapper | ||
--slds-g-color-surface-container-2 | Nested container | Inner panel | ||
--slds-g-color-surface-container-3 | Deep nested container | Collapsible section | ||
--slds-g-color-on-surface-1 | Primary text | Body text | ||
--slds-g-color-on-surface-2 | Secondary text | Labels, captions | ||
--slds-g-color-on-surface-3 | Tertiary text | Placeholder, disabled | ||
--slds-g-color-border-1 | Default border | Card border, dividers | ||
--slds-g-color-border-2 | Subtle border | Inner separators | ||
| Hook | Purpose | |||
--slds-g-color-accent-1 | Primary interactive (links, active) | |||
--slds-g-color-accent-2 | Secondary interactive | |||
--slds-g-color-accent-3 | Tertiary interactive | |||
--slds-g-color-accent-container-1 | Active/selected background | |||
--slds-g-color-on-accent-1 | Text on accent background | |||
--slds-g-color-border-accent-1 | Active/focus border | |||
| State | Color | Container | Text | Border |
| Error | error-1, error-2 | error-container-1 | on-error-1 | border-error-1 |
| Warning | warning-1, warning-2 | warning-container-1 | on-warning-1 | border-warning-1 |
| Success | success-1, success-2 | success-container-1 | on-success-1 | border-success-1 |
| Info | info-1, info-2 | info-container-1 | on-info-1 | — |
| Disabled | disabled-1, disabled-2 | disabled-container-1 | on-disabled-1 | border-disabled-1 |
| Hook | Purpose | |||
--slds-g-font-size-1 through -15 | Font size scale (1 = smallest) | |||
--slds-g-font-size-base | Root font size | |||
--slds-g-font-weight-1 through -7 | Weight scale (4 = normal, 7 = bold) | |||
--slds-g-line-height-1 through -5 | Line height scale (unitless) | |||
| Hook | Scale | |||
--slds-g-spacing-1 through -12 | Modular scale of 4, relative to root font size | |||
| Hook | Scale | |||
--slds-g-sizing-1 through -12 | Relative to root font size | |||
| Hook | Purpose | |||
--slds-g-shadow-1 through -4 | Elevation layers (1 = subtle, 4 = prominent) | |||
--slds-g-radius-border-1 through -4 | Corner radius scale | |||
--slds-g-radius-circle | Circle (50%) | |||
--slds-g-radius-border-pill | Pill shape | |||
--slds-g-sizing-border-1 through -4 | Border width scale | |||
| SLDS 1 (Deprecated) | SLDS 2 Replacement | |||
var(--lwc-colorBackground) | var(--slds-g-color-surface-1) | |||
var(--lwc-colorTextDefault) | var(--slds-g-color-on-surface-1) | |||
var(--lwc-colorBorder) | var(--slds-g-color-border-1) | |||
var(--lwc-colorTextLink) | var(--slds-g-color-accent-1) | |||
var(--lwc-colorTextError) | var(--slds-g-color-error-1) | |||
var(--lwc-colorTextSuccess) | var(--slds-g-color-success-1) | |||
var(--lwc-colorTextWarning) | var(--slds-g-color-warning-1) | |||
var(--lwc-spacingMedium) | var(--slds-g-spacing-4) | |||
var(--lwc-borderRadiusMedium) | var(--slds-g-radius-border-2) | |||
var(--lwc-fontSize4) | var(--slds-g-font-size-5) | |||
var(--lwc-fontWeightBold) | var(--slds-g-font-weight-7) | |||
t-salesforce-sans (font token) | var(--slds-g-font-family) | |||
| Category | Points | Pass Criteria | ||
| SLDS 2 Hook Usage | 25 | All colors, spacing, sizing, typography use --slds-g- hooks | ||
| Theme-Safe Styling | 20 | Zero hardcoded colors; fallbacks on every var(); no inline styles | ||
| Migration Compliance | 15 | No SLDS 1 --lwc- tokens; no deprecated class names | ||
| Component Structure | 15 | Uses lightning- base components where available; semantic HTML | ||
| Surface/Accent/Feedback | 15 | Correct semantic use of color categories (not accent for errors, etc.) | ||
| Typography & Spacing | 10 | Consistent use of scale hooks; no magic numbers | ||
| Skill | Relationship | |||
| sf-lwc | Handles JS logic, wire service, Apex, Jest — this skill handles design tokens | |||
| sf-lwc-ux | Consumes the design foundation for UX patterns and accessibility | |||
| sf-lwc-styling | Maps these hooks to utility-first CSS classes |
DependenciesReference
- Target org with SLDS 2 support (API 62.0+, Spring '25+)
- Salesforce Cosmos theme enabled (or custom SLDS 2 theme)
sfCLI authenticated for deployment validation
Navigate Look & Feel