forcedotcom/sf-skills / plugins/builder/experience-lwc/skills/experience-lwc-base-components-integrate
experience-lwc-base-components-integrate
VerifiedPick the right Lightning Base Component (`lightning-*`) for a given UI task, retrieve its full API (props, methods, events, slots) from the bundled per-component reference, and wire it into an LWC (LWC `.html`, `.js`, and `.css` files) without breaking SLDS. Use this skill when users say "I need a Lightning modal / datatable / combobox / record form", ask which `lightning-*` component fits a use case, want a shortlist of LBC candidates, are about to hand-roll a UI that a base component already provides, or are editing an LWC bundle's `.html` / `.js` / `.css` and need to select or wire a base component. Also triggers on "Lightning base component", "LBC", "lightning-combobox", "lightning-datatable", "use `lightning-` tag". DO NOT TRIGGER for applying SLDS design tokens, blueprints, or styling guidance in general — that is `design-systems-slds-apply`; this skill only selects and wires `lightning-*` base components.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 8.3 KB |
| references/lbc-expert-guidance.md | markdown | 3.8 KB |
| references/lightning-component-index.md | markdown | 24.8 KB |
| references/lightning-components.md | markdown | 431.3 KB |
| scripts/extract-component-docs.shexecutable | script | 1.7 KB |
references/lbc-expert-guidance.md
View on GitHub# Lightning Base Component Styling Guidelines
## Description
Styling guidelines for Lightning Web Components that consume Lightning Base Components: when component CSS layers custom styles on top of `lightning-*` components, certain SLDS-class usage patterns break the SLDS contract and must be rewritten to use component-owned custom classes.
## The core rule
Never target an SLDS class (`.slds-*`) in a component's CSS, either directly or as part of a compound selector. SLDS classes are owned by SLDS and may change their internal styling at any time; overriding them invalidates the SLDS guarantee.
## Scope
These guidelines apply when:
- The LWC uses one or more `lightning-*` Base Components, AND
- The component CSS contains selectors that include `.slds-*` class names.
## Fix pattern
Replace direct or compound SLDS-class selectors with component-owned custom classes. The fix always touches **both** the HTML template (to add the custom class) and the CSS (to retarget the selector).
### Example — overriding SLDS class properties directly
**Before**
CSS:
```css
.slds-button {
background: pink;
}
.slds-component_active .slds-combobox {
display: block;
}
```
HTML:
```html
<template>
<button class="slds-button">Click me</button>
<div class="slds-component_active slds-combobox">I'm going to display something based on state</div>
</template>
```
**Problem:** the CSS overrides SLDS styles directly. This invalidates the SLDS contract and breaks under SLDS internal changes.
**After**
HTML — add custom classes alongside the existing SLDS classes:
```html
<template>
<button class="slds-button primary-button">Click me</button>
<div class="slds-component_active slds-combobox active-display">I'm going to display something based on state</div>
</template>
```
CSS — target the custom classes, with the SLDS classes removed from the selectors entirely:
```css
.primary-button {
background: pink;
}
.active-display {
display: block;
}
```
### Key properties of the fix
- HTML: introduce a new custom class name (e.g. `primary-button`, `active-display`) on the element that needs styling.
- CSS: rewrite the selector to target the new custom class. The SLDS class is **completely removed** from the selector.
- Markup structure (tags, nesting, attributes other than `class`) is never changed.
## How to apply
For each LWC that uses a `lightning-*` Base Component, scan the CSS for selectors that contain `.slds-*` (direct or compound). For each occurrence, produce a paired HTML+CSS edit:
1. **HTML** — add a new custom class (kebab-case, component-scoped name) to the element being styled, alongside the existing SLDS class. Do not change tags, nesting, or any non-`class` attribute.
2. **CSS** — rewrite the selector to target the new custom class only. Remove the `.slds-*` segment from the selector entirely.
Produce one fix entry per violation with: file + line number for the HTML edit, file + line number for the CSS edit, and the corrected selector. Apply the same custom-class naming convention consistently across all violations in the same component.
### Example: component with SLDS class in CSS selector
**Component HTML:**
```html
<template>
<div class="fooDiv">
<button class="slds-button">Click me</button>
</div>
</template>
```
**Component CSS:**
```css
.fooDiv .slds-button {
background-color: red;
}
```
**Issue:** The CSS selector `.fooDiv .slds-button` targets the SLDS class directly. This overrides SLDS internal styles and breaks the SLDS contract.
**Fix:**
Add a custom class to the `button` element on line 3 of the HTML:
```html
<template>
<div class="fooDiv">
<button class="slds-button custom-button">Click me</button>
</div>
</template>
```
Retarget the CSS selector to the custom class:
```css
.custom-button {
background-color: red;
}
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| 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: 322k | Updated | Claude CodeCodex | Verified | Install |
| 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: 198k | Updated | Claude CodeCodex | Verified | Install |
| 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: 198k | Updated | Claude CodeCodex | Verified | Install |
| 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: 198k | Updated | Claude CodeCodex | Verified | Install |