afv-library/skills/applying-slds/guidance/utilities/box.md
Shelby Hubick 119dc668d5
@W-21965936@ Add applying and validating SLDS skills to afv-library (#187)
* 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
2026-04-26 21:03:14 +05:30

4.3 KiB

id title description summary artifact_type domain topic content_format complexity audience tasks refs tags keywords
slds.guidance.utilities.box Box Utilities SLDS box utility classes for containers with padding and borders Utilities for creating styled containers with padding, borders, and interactive states. Use with theme utilities for semantic colors. reference utilities box structured intermediate
implementer
implement
slds.guidance.utilities
slds.guidance.overview.utilities
slds.guidance.utilities.themes
slds.guidance.utilities.borders
slds.guidance.utilities.padding
utilities
box
containers
padding
borders
slds-box
slds-box_xx-small
slds-box_x-small
slds-box_small
slds-box_link
container
padding

Box Utilities

Utilities for creating styled containers with consistent padding, borders, and interactive states.

Core Classes

Class Purpose
slds-box Creates a container with 16px padding, rounded corners, and subtle border
slds-box_xx-small Container with 4px padding for compact layouts
slds-box_x-small Container with 8px padding for small content areas
slds-box_small Container with 12px padding for slightly reduced spacing
slds-box_link Makes box clickable with hover/focus states and accent border

Common Patterns

Basic Container

<!-- Standard box container with default 16px padding -->
<div class="slds-box">
  <h3 class="slds-text-heading_small">Container Title</h3>
  <p>Content with consistent padding and subtle border styling.</p>
</div>

Themed Notification Box

<!-- Success notification with semantic colors (see themes.md for theme utilities) -->
<div class="slds-box slds-theme_success">
  <div class="slds-media">
    <div class="slds-media__figure">
      <span class="slds-icon_container">
        <svg class="slds-icon slds-icon_small">
          <use xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#success"></use>
        </svg>
      </span>
    </div>
    <div class="slds-media__body">
      <p>Operation completed successfully.</p>
    </div>
  </div>
</div>
<!-- Clickable box that navigates to detail view -->
<a href="/record/detail" class="slds-box slds-box_link">
  <h3 class="slds-text-heading_small">Account Name</h3>
  <dl class="slds-list_horizontal slds-wrap">
    <dt class="slds-item_label">Type:</dt>
    <dd class="slds-item_detail">Customer</dd>
    <dt class="slds-item_label">Revenue:</dt>
    <dd class="slds-item_detail">$1.2M</dd>
  </dl>
</a>

Compact Info Card

<!-- Small padding variant for dense layouts (see themes.md for theme utilities) -->
<div class="slds-box slds-box_x-small slds-theme_shade">
  <div class="slds-grid slds-grid_align-spread">
    <span class="slds-text-body_small">Last Updated</span>
    <span class="slds-text-body_small">2 hours ago</span>
  </div>
</div>

Error Message Box

<!-- Error state with semantic styling (see themes.md for theme utilities) -->
<div class="slds-box slds-theme_error" role="alert">
  <h3 class="slds-text-heading_small">Validation Error</h3>
  <ul class="slds-list_dotted">
    <li>Email address is required</li>
    <li>Phone number format is invalid</li>
  </ul>
</div>

Best Practices

Use slds-box for consistent container styling across components Combine box utilities with theme utilities (see Themes Utilities) for semantic state communication Use slds-box_link for entire containers that are clickable Combine size variants with theme classes for flexible layouts Apply role="alert" to error and warning themed boxes for accessibility

Don't nest multiple slds-box containers without purpose Don't apply slds-box_link to non-interactive elements Don't override box padding with inline styles - use the size variants instead