mirror of
https://github.com/forcedotcom/afv-library.git
synced 2026-08-03 13:44:09 +08:00
* feat: add SLDS applying and auditing quality skills Two new skills for SLDS v2 compliance: - applying-slds: guides artifact selection, styling hooks, utilities, icons - auditing-slds-quality: scored quality audit with linter + static analysis Made-with: Cursor * refactor: rename auditing-slds-quality skill to validating-slds Renames the skill directory and updates all references in applying-slds/SKILL.md and applying-slds/checklists.md. Made-with: Cursor * fix: improve accuracy and add manual review gate across SLDS skills Correct hook families, badge modifiers, and severity levels; add a manual review gate to validating-slds so automated grades alone cannot declare production readiness; make analyze-quality.cjs portable with explicit --hooks-index flag; remove dead parseYaml code; add version field to all three skill frontmatters. Made-with: Cursor * chore: retrigger CI Made-with: Cursor * fix: quote YAML descriptions and improve color hook disambiguation - Quote description frontmatter in all three skills for valid YAML (inner double quotes now escaped) - Strengthen Step 4 directive: MUST read color-hooks guide before choosing a hook — linter suggestions are unranked - Add surface vs surface-container disambiguation table - Add accent hook context table and state progression - Add standalone-component exception for surface classification - Add modal background example to examples.md - Remove redundant brand-button example (covered by new context table) Made-with: Cursor
3.7 KiB
3.7 KiB
Component & Blueprint Selection
How to find the right SLDS artifact for a UI pattern.
Decision Flow
What framework?
├─ LWC → Check Lightning Base Component (LBC) first
│ ├─ LBC exists → Use it. Done.
│ └─ No LBC → Fall through to SLDS Blueprint
├─ React / Vue / Angular / vanilla → Skip LBC, go to SLDS Blueprint
└─ Any framework → No blueprint match? → Build custom with styling hooks
Step 1: Check for LBC (LWC only)
Lightning Base Components are pre-built, accessible, themed LWC components.
Always check first: Lightning Component Library
Common LBCs and their use cases:
| Component | Use Case |
|---|---|
lightning-button |
All button actions |
lightning-input |
Text, email, number, date inputs |
lightning-combobox |
Dropdown selection |
lightning-datatable |
Tabular data with sorting/selection |
lightning-card |
Content containers |
lightning-modal |
Dialog overlays |
lightning-icon |
SLDS icons |
lightning-layout |
Responsive grid layout |
If an LBC exists, use it. Do not build a custom version from blueprint markup.
Step 2: Search SLDS Blueprints
Blueprints are HTML/CSS patterns that work in any framework. Use when no LBC exists or when not building in LWC.
How to search
# Keyword search
node scripts/search-blueprints.cjs --search "dialog"
# Browse by category
node scripts/search-blueprints.cjs --category "Overlay"
# Get full details for a specific blueprint
node scripts/search-blueprints.cjs --name "modals"
Blueprint categories
| Category | Examples |
|---|---|
| Layout | Cards, Tiles, Page Headers |
| Forms | Input, Select, Combobox, Checkbox, Radio, Textarea |
| Navigation | Tabs, Vertical Navigation, Breadcrumbs, Path |
| Data Display | Data Tables, Trees, Activity Timeline |
| Feedback | Alert, Toast, Scoped Notifications, Spinners |
| Overlay | Modals, Popovers, Tooltips, Prompt |
| Media | Avatar, Carousel, Files, Illustration |
| Actions | Buttons, Button Groups, Button Icons, Menus |
How to read a blueprint YAML
Each file in metadata/blueprints/components/{name}.yaml contains:
name: "Modals"
description: "Dialog overlays..."
category: "Overlay"
slds_classes:
root: "slds-modal" # The BEM root class to apply
elements: # Child element classes
- class: "slds-modal__header"
purpose: "Contains title and close action"
modifiers: # Size/style variants
- class: "slds-modal_large"
usage: "For complex forms or detailed content"
states: # State classes
- class: "slds-fade-in-open"
accessibility: # Required ARIA attributes
roles: ["dialog"]
attributes: ["aria-modal", "aria-labelledby"]
example_html: "..." # Reference markup
Use the root class, add elements for structure, modifiers for variants, and follow accessibility requirements.
Step 3: Custom with Styling Hooks
If no LBC or blueprint matches your need, build custom markup with SLDS styling hooks.
See styling-decision-guide.md for how to apply hooks correctly.
Rules for custom components:
- Use custom class prefixes (
my-*,c-*) -- never overrideslds-*classes - Use
var(--slds-g-*, fallback)for all themeable values - Follow the blueprint naming pattern (BEM-like) for consistency
Deep Reference
- Full blueprint details:
guidance/blueprints-index.md - All blueprint YAMLs:
metadata/blueprints/components/ - LBC documentation: Lightning Component Library