"use client" import { Card, CardContent } from "@/components/ui/card" import { SectionHeading } from "@/components/ui/section-heading" import { ComponentShowcase } from "@/components/ui/component-showcase" import { useMaterial } from "@/contexts/material-context" import { cn } from "@/lib/utils" export function ElevationSection() { const { selectedMaterial } = useMaterial() const materialClass = selectedMaterial?.className || "" return (

Elevation in UI design creates a visual hierarchy that helps users understand the relationship between elements. Higher elevation suggests prominence and interactivity, while lower elevation indicates background or supporting elements.

Elevation Guidelines

When to Use

  • Level 0: Backgrounds, disabled elements
  • Level 1: Cards, buttons, form inputs
  • Level 2: Active elements, dropdowns, navigation
  • Level 3: Modals, dialogs, floating elements

Best Practices

  • Use elevation to establish visual hierarchy
  • Increase elevation for interactive states
  • Limit elevation levels in a single view
  • Apply consistently across similar components

Implementation

Apply elevation using Tailwind's shadow utility classes. Each elevation level maps to a specific shadow class.

Shadow Classes

shadow-none Level 0 (Flat)
shadow-sm Level 1 (Low)
shadow-md Level 2 (Medium)
shadow-lg Level 3 (High)

Basic Example

                  {`
Medium elevation card
`}

Interactive Example

                  {``}
                
) } function ElevationCard({ level }: { level: number }) { const { selectedMaterial } = useMaterial() const materialClass = selectedMaterial?.className || "" const shadowClasses = [ "shadow-none", // Level 0 "shadow-sm", // Level 1 "shadow-md", // Level 2 "shadow-lg", // Level 3 ] return (
Elevation {level}
Level {level}
) }