forcedotcom/sf-skills / skills/design-systems-slds-apply
design-systems-slds-apply
UnverifiedApply 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".
references/utilities/layout.md
View on GitHub---
id: slds.guidance.utilities.layout
title: Layout Utilities
description: SLDS layout utility classes for global spacing and component connection
summary: "Utilities for global spacing (has-buffer, has-full-bleed, magnet utilities). Provides consistent buffer margins, full-bleed layouts, and seamless card connections."
artifact_type: reference
domain: utilities
topic: layout
content_format: structured
complexity: intermediate
audience: [implementer]
tasks: [implement]
refs:
- slds.guidance.utilities
- slds.guidance.overview.utilities
- slds.guidance.hooks.spacing
tags: [utilities, layout, spacing, magnet]
keywords: [slds-has-buffer, slds-has-full-bleed, slds-has-magnet]
---
# Layout - Global Spacing & Component Connection
Global spacing management and seamless component connections.
## Core Classes
| Class | Purpose |
|-------|---------|
| `slds-has-buffer` | Applies consistent global margin using `--slds-g-spacing-3` token |
| `slds-has-full-bleed` | Removes all margins to create full-bleed layouts |
| `slds-has-bottom-magnet` | Removes bottom margin and border radius to connect with element below |
| `slds-has-top-magnet` | Removes top margin and border radius to connect with element above |
## Common Patterns
### Standard Buffer Spacing
```html
<!-- Apply consistent spacing around cards -->
<div class="slds-card slds-has-buffer">
<div class="slds-card__header">Card with buffer margin</div>
<div class="slds-card__body">Content has global spacing on all sides</div>
</div>
```
### Full-Bleed Hero Section
```html
<!-- Remove margins for edge-to-edge layouts -->
<div class="slds-page-header slds-has-full-bleed">
<div class="slds-page-header__row">
<div class="slds-page-header__col-title">Full-width header with no margins</div>
</div>
</div>
```
### Connected Card Components
```html
<!-- Connect two cards vertically without gap -->
<div class="slds-card slds-has-bottom-magnet">
<div class="slds-card__header">First Card</div>
<div class="slds-card__body">This card connects to the one below</div>
</div>
<div class="slds-card slds-has-top-magnet">
<div class="slds-card__header">Second Card</div>
<div class="slds-card__body">Appears seamlessly connected to card above</div>
</div>
```
### Multiple Connected Components
```html
<!-- Chain multiple cards together -->
<div class="slds-box slds-has-bottom-magnet">
<h2>Section Header</h2>
</div>
<div class="slds-card slds-has-top-magnet slds-has-bottom-magnet">
<div class="slds-card__body">Middle card connected on both sides</div>
</div>
<div class="slds-box slds-has-top-magnet">
<p>Footer content</p>
</div>
```
### Combined Buffer and Magnet
```html
<!-- Use buffer with magnet for special layouts -->
<div class="slds-card slds-has-buffer slds-has-bottom-magnet">
<div class="slds-card__body">Card with side margins but connected below</div>
</div>
<div class="slds-card slds-has-top-magnet slds-has-buffer">
<!-- Special case: removes bottom margin, border-radius, top border, and box-shadow -->
<div class="slds-card__body">Connected card with modified buffer behavior</div>
</div>
```
## Best Practices
✅ Use `slds-has-buffer` on cards and boxes for consistent component spacing
✅ Apply magnet utilities to Cards, Page Headers, and Box components
✅ Use `slds-has-bottom-magnet` on the top component and `slds-has-top-magnet` on the bottom component
✅ Use `slds-has-full-bleed` for hero sections and full-width backgrounds
❌ Avoid using magnet utilities on non-card-like elements
❌ Do not mix magnet utilities with custom margin styles
❌ Never apply `slds-has-full-bleed` to components that need spacing
❌ Do not use magnet utilities when visual separation is neededRelated 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 |