Skip to content

forcedotcom/sf-skills / skills/design-systems-slds-apply

design-systems-slds-apply

Unverified

Apply SLDS-compliant UI using the correct blueprints, styling hooks, utility classes, and icons. Use when building any UI that needs SLDS, choosing between Lightning Base Components and SLDS Blueprints, applying styling hooks for theming, using utility classes for layout and spacing, or selecting icons. Triggers include "build a modal", "create a form", "data table", "SLDS styling", "style with hooks", "add an icon".

FileKindSize
SKILL.mdskill md14.6 KB
assets/README.mdmarkdown2.3 KB
assets/blueprints/components/accordion.yamlconfig15.0 KB
assets/blueprints/components/activity-timeline.yamlconfig3.8 KB
assets/blueprints/components/alert.yamlconfig4.4 KB
assets/blueprints/components/app-launcher.yamlconfig3.8 KB
assets/blueprints/components/avatar-group.yamlconfig3.2 KB
assets/blueprints/components/avatar.yamlconfig3.5 KB
assets/blueprints/components/badges.yamlconfig3.3 KB
assets/blueprints/components/brand-band.yamlconfig12.9 KB
assets/blueprints/components/breadcrumbs.yamlconfig4.0 KB
assets/blueprints/components/builder-header.yamlconfig10.1 KB
assets/blueprints/components/button-groups.yamlconfig3.1 KB
assets/blueprints/components/button-icons.yamlconfig12.9 KB
assets/blueprints/components/buttons.yamlconfig9.4 KB
assets/blueprints/components/cards.yamlconfig4.6 KB
assets/blueprints/components/carousel.yamlconfig6.0 KB
assets/blueprints/components/chat.yamlconfig9.7 KB
assets/blueprints/components/checkbox-button-group.yamlconfig8.3 KB
assets/blueprints/components/checkbox-button.yamlconfig13.8 KB
assets/blueprints/components/checkbox-toggle.yamlconfig7.7 KB
assets/blueprints/components/checkbox.yamlconfig4.4 KB
assets/blueprints/components/color-picker.yamlconfig8.5 KB
assets/blueprints/components/combobox.yamlconfig5.5 KB
assets/blueprints/components/counter.yamlconfig6.6 KB
assets/blueprints/components/data-tables.yamlconfig6.0 KB
assets/blueprints/components/datepickers.yamlconfig6.1 KB
assets/blueprints/components/datetime-picker.yamlconfig7.4 KB
assets/blueprints/components/docked-composer.yamlconfig13.3 KB
assets/blueprints/components/docked-form-footer.yamlconfig6.1 KB
assets/blueprints/components/docked-utility-bar.yamlconfig10.9 KB
assets/blueprints/components/drop-zone.yamlconfig4.5 KB
assets/blueprints/components/dueling-picklist.yamlconfig8.8 KB
assets/blueprints/components/dynamic-icons.yamlconfig5.0 KB
assets/blueprints/components/dynamic-menu.yamlconfig7.7 KB
assets/blueprints/components/expandable-section.yamlconfig4.6 KB
assets/blueprints/components/expression.yamlconfig7.3 KB
assets/blueprints/components/feeds.yamlconfig5.7 KB
assets/blueprints/components/file-selector.yamlconfig6.8 KB
assets/blueprints/components/files.yamlconfig4.8 KB
assets/blueprints/components/form-element.yamlconfig6.1 KB
assets/blueprints/components/global-header.yamlconfig4.7 KB
assets/blueprints/components/global-navigation.yamlconfig4.3 KB
assets/blueprints/components/icons.yamlconfig5.1 KB
assets/blueprints/components/illustration.yamlconfig8.5 KB
assets/blueprints/components/input.yamlconfig5.4 KB
assets/blueprints/components/list-builder.yamlconfig6.2 KB
assets/blueprints/components/lookups.yamlconfig5.8 KB
assets/blueprints/components/map.yamlconfig5.0 KB
assets/blueprints/components/menus.yamlconfig5.5 KB
assets/blueprints/components/modals.yamlconfig6.1 KB
assets/blueprints/components/notifications.yamlconfig3.1 KB
assets/blueprints/components/page-headers.yamlconfig6.0 KB
assets/blueprints/components/panels.yamlconfig6.8 KB
assets/blueprints/components/path.yamlconfig6.4 KB
assets/blueprints/components/picklist.yamlconfig5.2 KB
assets/blueprints/components/pills.yamlconfig5.9 KB
assets/blueprints/components/popovers.yamlconfig4.6 KB
assets/blueprints/components/progress-bar.yamlconfig4.4 KB
assets/blueprints/components/progress-indicator.yamlconfig5.6 KB
assets/blueprints/components/progress-ring.yamlconfig4.0 KB
assets/blueprints/components/prompt.yamlconfig5.5 KB
assets/blueprints/components/publishers.yamlconfig7.0 KB
assets/blueprints/components/radio-button-group.yamlconfig7.3 KB
assets/blueprints/components/radio-group.yamlconfig5.0 KB
assets/blueprints/components/rich-text-editor.yamlconfig6.0 KB
assets/blueprints/components/scoped-notifications.yamlconfig7.6 KB
assets/blueprints/components/scoped-tabs.yamlconfig3.7 KB
assets/blueprints/components/select.yamlconfig4.3 KB
assets/blueprints/components/setup-assistant.yamlconfig8.8 KB
assets/blueprints/components/slider.yamlconfig4.2 KB
assets/blueprints/components/spinners.yamlconfig5.4 KB
assets/blueprints/components/split-view.yamlconfig4.4 KB
assets/blueprints/components/summary-detail.yamlconfig4.1 KB
assets/blueprints/components/tabs.yamlconfig6.1 KB
assets/blueprints/components/textarea.yamlconfig4.6 KB
assets/blueprints/components/tiles.yamlconfig4.0 KB
assets/blueprints/components/timepicker.yamlconfig5.1 KB
assets/blueprints/components/toast.yamlconfig6.5 KB
assets/blueprints/components/tooltips.yamlconfig4.1 KB
assets/blueprints/components/tree-grid.yamlconfig4.9 KB
assets/blueprints/components/trees.yamlconfig4.8 KB
assets/blueprints/components/trial-bar.yamlconfig4.2 KB
assets/blueprints/components/vertical-navigation.yamlconfig5.2 KB
assets/blueprints/components/vertical-tabs.yamlconfig6.9 KB
assets/blueprints/components/visual-picker.yamlconfig6.8 KB
assets/blueprints/components/welcome-mat.yamlconfig5.5 KB
assets/hooks-index.jsonconfig141.1 KB
assets/icon-metadata.jsonconfig919.3 KB
assets/utilities-index.jsonconfig508.6 KB
references/README.mdmarkdown5.8 KB
references/blueprints-index.mdmarkdown9.0 KB
references/checklists.mdmarkdown3.8 KB
references/component-selection.mdmarkdown3.7 KB
references/examples.mdmarkdown8.1 KB
references/icons-decision-guide.mdmarkdown3.8 KB
references/icons-guidance.mdmarkdown6.2 KB
references/overviews/borders.mdmarkdown11.0 KB
references/overviews/color.mdmarkdown12.0 KB
references/overviews/display-density.mdmarkdown18.7 KB
references/overviews/icons.mdmarkdown9.3 KB
references/overviews/illustrations.mdmarkdown10.3 KB
references/overviews/shadows.mdmarkdown7.0 KB
references/overviews/spacing.mdmarkdown9.8 KB
references/overviews/typography.mdmarkdown14.8 KB
references/overviews/utilities.mdmarkdown23.9 KB
references/slds-development-guide.mdmarkdown8.8 KB
references/styling-decision-guide.mdmarkdown9.3 KB
references/styling-hooks/borders.mdmarkdown9.0 KB
references/styling-hooks/color/expressive-palette-hooks.mdmarkdown6.7 KB
references/styling-hooks/color/index.mdmarkdown6.5 KB
references/styling-hooks/color/semantic/accent-hooks.mdmarkdown9.9 KB
references/styling-hooks/color/semantic/feedback-hooks.mdmarkdown33.4 KB
references/styling-hooks/color/semantic/surface-hooks.mdmarkdown17.1 KB
references/styling-hooks/color/system-hooks.mdmarkdown5.8 KB
references/styling-hooks/index.mdmarkdown10.8 KB
references/styling-hooks/shadows.mdmarkdown8.3 KB
references/styling-hooks/spacing.mdmarkdown12.3 KB
references/styling-hooks/typography.mdmarkdown17.8 KB
references/utilities-quick-ref.mdmarkdown3.7 KB
references/utilities/alignment.mdmarkdown3.7 KB
references/utilities/borders.mdmarkdown4.0 KB
references/utilities/box.mdmarkdown4.3 KB
references/utilities/color.mdmarkdown7.7 KB
references/utilities/dark-mode.mdmarkdown3.5 KB
references/utilities/description-list.mdmarkdown5.5 KB
references/utilities/floats.mdmarkdown3.8 KB
references/utilities/grid.mdmarkdown9.7 KB
references/utilities/horizontal-list.mdmarkdown3.7 KB
references/utilities/hyphenation.mdmarkdown2.3 KB
references/utilities/index.mdmarkdown6.6 KB
references/utilities/interactions.mdmarkdown3.1 KB
references/utilities/layout.mdmarkdown3.6 KB
references/utilities/line-clamp.mdmarkdown4.3 KB
references/utilities/margin.mdmarkdown5.2 KB
references/utilities/media-object.mdmarkdown5.3 KB
references/utilities/name-value-list.mdmarkdown4.8 KB
references/utilities/padding.mdmarkdown5.3 KB
references/utilities/position.mdmarkdown5.9 KB
references/utilities/print.mdmarkdown3.0 KB
references/utilities/scrollable.mdmarkdown4.1 KB
references/utilities/sizing.mdmarkdown5.7 KB
references/utilities/themes.mdmarkdown4.0 KB
references/utilities/truncate.mdmarkdown3.7 KB
references/utilities/typography.mdmarkdown4.6 KB
references/utilities/vertical-list.mdmarkdown5.1 KB
references/utilities/visibility.mdmarkdown6.1 KB
scripts/search-blueprints.cjsscript3.6 KB
scripts/search-hooks.cjsscript4.4 KB
scripts/search-icons.cjsscript6.1 KB
scripts/search-utilities.cjsscript5.3 KB

references/styling-decision-guide.md

View on GitHub
# Styling Decision Guide

How to apply SLDS styling correctly using hooks, utilities, and custom CSS.

---

## Styling Hook Hierarchy

SLDS hooks follow a three-tier naming system:

| Tier | Prefix | Use |
|------|--------|-----|
| **Global Semantic** | `--slds-g-*` | System-wide. Use these by default. |
| **Shared** | `--slds-s-*` | Private/internal. **DO NOT USE.** Reserved for Salesforce. |
| **Component** | `--slds-c-*` | Scoped to specific LBCs. Use to customize LBC appearance. |

**Rule: Always use `--slds-g-*` hooks unless `--slds-c-*` hooks exist for your specific LBC.**

### Discovering `--slds-c-*` Hooks

Component hooks are scoped to specific Lightning Base Components. To find available hooks for an LBC:

1. **Inspect the LBC docs**: Check the component's [Lightning Component Library](https://developer.salesforce.com/docs/component-library/overview/components) page — look for "Styling Hooks" or "Custom Properties" sections
2. **Browser DevTools**: Render the LBC, inspect the element, and look for `--slds-c-*` properties in the computed styles
3. **Known patterns**: Component hooks follow `--slds-c-{component}-{property}-{state}` naming, e.g., `--slds-c-button-success-shadow-hover`

There is no centralized metadata file for `--slds-c-*` hooks — they are documented per-component. Some examples exist in `references/overviews/shadows.md` and `references/styling-hooks/index.md`.

---

## Hook Syntax

Always use `var()` with a fallback value:

```css
.my-card {
  background: var(--slds-g-color-surface-1, #ffffff);
  padding: var(--slds-g-spacing-4, 1rem);
  border-radius: var(--slds-g-radius-border-2, 0.25rem);
}
```

**Never reassign hook values.** Salesforce controls them and can change them.

### Choosing Fallback Values

The fallback in `var(--slds-g-*, fallback)` is used when the hook isn't loaded (e.g., outside Lightning Experience, in static HTML previews, or during SSR). Use the **light-mode default** value:

1. **Look up the value in `assets/hooks-index.json`** — each hook has a `value` field showing its resolved default
2. **Use the search script**: `node scripts/search-hooks.cjs --prefix "--slds-g-color-surface-"` shows values
3. **Common defaults**: `#ffffff` for surfaces, `#181818` for text, `1rem` for spacing-4, `0.25rem` for radius-border-2

Always use the light-mode default. Dark-mode values are applied automatically when the hook is active — the fallback only matters when hooks aren't loaded at all.

---

## Color: The 85-5-10 Rule

All SLDS UIs should maintain this approximate color distribution:

| % | Role | What to use |
|---|------|-------------|
| **85%** | Foundation | Surfaces, backgrounds, containers. Neutral colors: whites, grays. Hooks: `--slds-g-color-surface-*` |
| **5%** | Accents | Primary actions, selected states, key CTAs. Hooks: `--slds-g-color-accent-*` |
| **10%** | Expressive | Data viz, custom branding. Use sparingly. Hooks: `--slds-g-color-palette-*` |

### Color Role Selection

Before picking a hook, classify what the color is for:

| Role | Hook prefix | Examples |
|------|-------------|----------|
| Surface (backgrounds) | `--slds-g-color-surface-*` | Page bg, modal bg, top-level panels |
| Surface container (nested surfaces) | `--slds-g-color-surface-container-*` | Card bg, embedded panels, list items |
| On-surface (text on surfaces) | `--slds-g-color-on-surface-*` | Body text, headings, icons |
| Accent (emphasis) | `--slds-g-color-accent-*` | Primary emphasis, selected state text/icons |
| Accent container (accent backgrounds) | `--slds-g-color-accent-container-*` | Buttons, selected tabs, emphasized controls |
| Border | `--slds-g-color-border-*` | Dividers, card borders |
| Error | `--slds-g-color-error-*` | Validation errors |
| Success | `--slds-g-color-success-*` | Confirmation states |
| Warning | `--slds-g-color-warning-*` | Caution messages |

**Always pair surfaces with on-surfaces.** Example: `surface-1` background + `on-surface-2` text.

**CRITICAL:** All color hooks require a numbered variant. There is no unnumbered base form (e.g., `--slds-g-color-on-surface` does not exist -- use `on-surface-1`, `-2`, or `-3`):

| Variant | Emphasis | Use for |
|---------|----------|---------|
| `-1` | Low | Captions, placeholder text, de-emphasized content |
| `-2` | Medium | Body text, labels, standard content |
| `-3` | High | Page titles, headings, primary emphasis |

### How to search hooks

```bash
# By prefix
node scripts/search-hooks.cjs --prefix "--slds-g-color-surface-"

# By category
node scripts/search-hooks.cjs --category "color"

# By CSS property
node scripts/search-hooks.cjs --property "background-color"

# Find hook for a hardcoded value
node scripts/search-hooks.cjs --value "#0176d3"
```

---

## Spacing: 4-Point Grid

SLDS uses a numbered scale, not named sizes:

| Hook | Value | Pixels | Use for |
|------|-------|--------|---------|
| `--slds-g-spacing-1` | 0.25rem | 4px | Tight inline spacing |
| `--slds-g-spacing-2` | 0.5rem | 8px | Between related items |
| `--slds-g-spacing-3` | 0.75rem | 12px | Small gaps |
| `--slds-g-spacing-4` | 1rem | 16px | Standard padding/margin |
| `--slds-g-spacing-5` | 1.5rem | 24px | Section gaps |
| `--slds-g-spacing-6` | 2rem | 32px | Between sections |
| `--slds-g-spacing-8` | 3rem | 48px | Large separations |
| `--slds-g-spacing-12` | 5rem | 80px | Page-level spacing |

---

## Typography Hooks (Naming Exception)

Typography hooks break from the `{prefix}-{number}` pattern used by spacing and color:

| Hook | Pattern | Use |
|------|---------|-----|
| `--slds-g-font-size-base` | Single value | Base application font size (13px / 0.8125rem) |
| `--slds-g-font-scale-*` | Numbered scale | All other sizes: `font-scale-1` (14px) through `font-scale-10` |
| `--slds-g-font-scale-neg-*` | Negative scale | Smaller sizes: `font-scale-neg-1` through `neg-4` |
| `--slds-g-font-scale-var-*` | Density-aware | Adapts to compact/comfy display density settings |

**Common mappings:**

| Size | Hook | Approximate value |
|------|------|-------------------|
| Small body text | `--slds-g-font-scale-neg-1` | 12px |
| Default body | `--slds-g-font-size-base` | 13px |
| Larger body | `--slds-g-font-scale-1` | 14px |
| Subheading | `--slds-g-font-scale-2` | 16px |
| Heading | `--slds-g-font-scale-4` | 20px |
| Page title | `--slds-g-font-scale-6` | 28px |
| Display | `--slds-g-font-scale-8` | 40px |

**CRITICAL:** `--slds-g-font-size-3`, `--slds-g-font-size-4`, etc. do NOT exist. Only `--slds-g-font-size-base` is valid. For numbered sizes, use `--slds-g-font-scale-*`.

---

## When Hooks Don't Exist

Not all CSS properties have styling hooks. Not all values have hook equivalents either (e.g., `min-width: 7rem` for label alignment). Use this decision tree:

```text
Does a hook exist for this property?
├─ YES → Use it: var(--slds-g-*, fallback)
├─ NO → Is there a utility class?
│       ├─ YES → Use the utility class
│       └─ NO → Use minimal custom CSS with:
│               1. Custom class prefix (my-*, c-*)
│               2. Use hooks for related values (e.g., hook colors in gradients)
│               3. Document why no hook/utility exists
```

**Properties without hooks (use custom CSS):**
- `transform`, `transition` (use `--slds-g-duration-*` for timing only)
- `z-index` (use SLDS utility classes when possible)
- `cursor`, `overflow`
- Complex gradients (use hook colors within gradient syntax)

**Values without hook equivalents (acceptable hardcoding):**

Some dimension values have no SLDS hook (e.g., `min-width: 7rem` for label alignment, `max-height: 20rem` for scrollable panels). This is acceptable when:
1. No SLDS sizing hook or utility class covers the value
2. A comment explains the value is intentional
3. SLDS grid utilities (`slds-size_*`) were considered as alternatives

```css
.c-field-label {
  /* No SLDS hook exists for this width; intentional for label alignment */
  min-width: 7rem;
}
```

**Example -- gradient with hook colors:**
```css
.my-gradient-bg {
  background: linear-gradient(
    to bottom,
    var(--slds-g-color-surface-1, #ffffff),
    var(--slds-g-color-surface-2, #f3f3f3)
  );
}
```

---

## Hook vs. Utility vs. Custom CSS

| Need | First choice | Fallback |
|------|-------------|----------|
| Color (bg, text, border) | Hook: `var(--slds-g-color-*)` | -- |
| Spacing (margin, padding) | Utility: `slds-m-*`, `slds-p-*` | Hook: `var(--slds-g-spacing-*)` |
| Layout (grid, columns) | Utility: `slds-grid`, `slds-col` | -- |
| Typography (size) | Hook: `var(--slds-g-font-scale-*)` or `var(--slds-g-font-size-base)` | Utility: `slds-text-*` |
| Typography (weight) | Hook: `var(--slds-g-font-weight-*)` | -- |
| Visibility (show/hide) | Utility: `slds-hide`, `slds-show` | -- |
| Borders (width, radius) | Hook: `var(--slds-g-radius-*)` | Utility: `slds-border-*` |
| Shadows | Hook: `var(--slds-g-shadow-*)` | -- |
| Anything else | Custom CSS with custom class prefix | Use hook values where possible |

---

## Deep Reference

- Styling hooks index: `references/styling-hooks/index.md`
- Color hooks deep dive: `references/styling-hooks/color/`
- Color overview (85-5-10 rule): `references/overviews/color.md`
- Spacing overview: `references/overviews/spacing.md`
- Typography hooks: `references/styling-hooks/typography.md`
- Borders overview: `references/overviews/borders.md`
- Shadows overview: `references/overviews/shadows.md`
- All 523 hooks searchable: `assets/hooks-index.json`
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall