Skip to content

@vibe-labs/design-elevation

Box shadow, elevation, and focus ring tokens and utility classes for the Vibe Design System.

Installation

css
@import "@vibe-labs/design-elevation";

Tokens

CSS custom properties defined in @layer vibe.tokens:

Box Shadows

TokenDescription
--shadow-noneNo shadow
--shadow-xs--shadow-2xlElevation scale (6 levels)
--shadow-innerInset shadow

Focus Ring

TokenDefaultDescription
--ring-color--color-accentRing color
--ring-offset-color--surface-baseGap color between ring and element
--ring-offset-width2pxOffset gap width

Utilities / Generated Classes

Utility classes generated into @layer vibe.utilities via the build script.

Shadows

.shadow-none · .shadow-xs · .shadow-sm · .shadow-md · .shadow-lg · .shadow-xl · .shadow-2xl · .shadow-inner

Focus Rings

  • .ring-0 — remove ring
  • .ring-{w} — outer ring: 1 | 2 | 4
  • .ring-inset-{w} — inset ring: 1 | 2

Ring Colors

  • Palette: .ring-{color} — blue, brown, cyan, green, indigo, orange, pink, purple, red, teal, yellow
  • Status: .ring-success · .ring-warning · .ring-danger · .ring-info

Dist Structure

FileDescription
index.cssBarrel — imports both files below
elevation.cssToken definitions
elevation.g.cssGenerated utility classes

Dependencies

Requires --color-accent, --surface-base, and --color-* tokens from upstream packages.

Build

bash
npm run build

Usage Guide

Provides box shadow and focus ring utilities to communicate elevation and keyboard focus state in the Vibe Design System.

Import

css
@import "@vibe-labs/design-elevation";

Common Patterns

1. Communicate card elevation hierarchy

html
<div class="shadow-sm rounded-lg p-4">Resting card</div>
<div class="shadow-lg rounded-lg p-4">Elevated card (hovered)</div>
<div class="shadow-2xl rounded-xl p-6">Modal or dialog</div>

2. Inset shadow for pressed/active states

html
<button class="shadow-inner active:shadow-inner">
  Press me
</button>

3. Focus ring on interactive elements

html
<button class="ring-2 ring-blue focus:ring-4">
  Keyboard-focusable button
</button>

4. Status-coloured focus ring for form validation

html
<input class="ring-2 ring-danger" aria-invalid="true" />
<input class="ring-2 ring-success" aria-invalid="false" />

5. Inset ring for inputs (no layout shift)

html
<input class="ring-inset-2 ring-blue focus:ring-inset-2 focus:ring-blue" />

6. Remove shadow on mobile, show on desktop

css
.card {
  box-shadow: var(--shadow-none);
}

@media (min-width: 768px) {
  .card {
    box-shadow: var(--shadow-md);
  }
}

Token Reference

TokenDescription
--shadow-noneNo shadow
--shadow-xsVery subtle lift
--shadow-smSlight elevation (cards)
--shadow-mdModerate elevation
--shadow-lgHigh elevation (dropdowns)
--shadow-xlVery high (floating panels)
--shadow-2xlMaximum (modals)
--shadow-innerInset pressed effect
--ring-colorDefault: --color-accent

Vibe