Glassmorphism
Frosted translucent panels over deep gradients. Modern, layered, luminous.
Technologies Demonstrated
Color Palette
[Alpine]Primary
#a78bfa
Secondary
#60a5fa
Accent
#f472b6
BG
#0f0f1a
Surface (rgba)
#1c1c2e
Text
#f1f5f9
Muted
#94a3b8
Click any swatch to copy hex value to clipboard.
<div class="grid grid-cols-2 sm:grid-cols-4 md:grid-cols-7 gap-4"> @glassSwatch("Primary", "#a78bfa") @glassSwatch("Secondary", "#60a5fa") @glassSwatch("Accent", "#f472b6") @glassSwatch("BG", "#0f0f1a") @glassSwatch("Surface (rgba)", "#1c1c2e") @glassSwatch("Text", "#f1f5f9") @glassSwatch("Muted", "#94a3b8") </div>
Typography
Display — 3.5rem / Bold
Luminous
Heading — 1.5rem / Semibold
Frosted Glass Surfaces
Body — 1rem / Regular (300, 400, 500, 600, 700)
Light — translucent layers create depth without opacity
Regular — the standard weight for body text and descriptions
Medium — slightly elevated for labels and UI elements
Semibold — strong emphasis without the heaviness of bold
Bold — for headings and high-priority information
Caption — 0.8rem
Fig. 1 — Frosted glass effect requires CSS backdrop-filter support (Chrome 76+, Firefox 103+, Safari 9+)
Spacing Scale
Base unit: 4px
Buttons
[Alpine]Variants
Toggle Demo [Alpine]
<div x-data="{ active: false }" class="flex items-center gap-6"> <button class="px-5 py-2.5 text-sm font-semibold rounded-lg transition-all duration-200" { templ.Attributes{ ":class": "active ? 'glass-btn-primary' : 'glass-btn-ghost'", "@click": "active = !active", }... } > <span x-text="active ? 'Active State' : 'Inactive State'">Inactive State</span> </button> <span class="text-xs" style="color: var(--color-text-muted);" x-text="active ? 'Gradient glow active' : 'Frost mode'">Frost mode</span> </div>
Forms
[HTMX]<form hx-post="/guides/glass/demo-form" hx-target="#glass-form-response" hx-swap="innerHTML" class="space-y-5" > <div> <label class="block text-xs font-medium mb-1.5" style="color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.08em;" for="glass-name">Name</label> <input id="glass-name" name="name" type="text" placeholder="Enter your name..." class="glass-input" /> </div> <div> <label class="block text-xs font-medium mb-1.5" style="color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.08em;" for="glass-email">Email</label> <input id="glass-email" name="email" type="email" placeholder="hello@example.com" class="glass-input" /> </div> <div> <label class="block text-xs font-medium mb-1.5" style="color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.08em;" for="glass-theme">Theme Preference</label> <select id="glass-theme" name="theme" class="glass-input cursor-pointer"> <option value="" style="background: #1a1a2e;">— Select theme —</option> <option value="dark" style="background: #1a1a2e;">Deep Dark</option> <option value="aurora" style="background: #1a1a2e;">Aurora</option> <option value="cosmic" style="background: #1a1a2e;">Cosmic</option> </select> </div> <div class="flex items-center gap-3"> <input type="checkbox" id="glass-notify" name="notify" class="w-4 h-4 cursor-pointer" style="accent-color: var(--color-primary);"/> <label for="glass-notify" class="text-sm cursor-pointer" style="color: var(--color-text);">Enable blur-in notifications</label> </div> <!-- Radio buttons --> <div> <p class="text-xs font-medium mb-2" style="color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.08em;">Blur Level</p> <div class="space-y-2"> <label class="flex items-center gap-3 cursor-pointer text-sm" style="color: var(--color-text);"> <input type="radio" name="blur" value="subtle" class="w-4 h-4 cursor-pointer" style="accent-color: var(--color-primary);"/> Subtle (8px) </label> <label class="flex items-center gap-3 cursor-pointer text-sm" style="color: var(--color-text);"> <input type="radio" name="blur" value="medium" checked class="w-4 h-4 cursor-pointer" style="accent-color: var(--color-primary);"/> Medium (16px) </label> <label class="flex items-center gap-3 cursor-pointer text-sm" style="color: var(--color-text);"> <input type="radio" name="blur" value="heavy" class="w-4 h-4 cursor-pointer" style="accent-color: var(--color-primary);"/> Heavy (24px) </label> </div> </div> <!-- Textarea --> <div> <label class="block text-xs font-medium mb-1.5" style="color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.08em;" for="glass-notes">Notes</label> <textarea id="glass-notes" name="notes" placeholder="Additional details..." rows="3" class="glass-input" ></textarea> </div> <button type="submit" class="glass-btn-primary px-6 py-2.5 text-sm w-full"> Submit via HTMX </button> </form>
Cards & Panels
[Alpine]Light Frost
Subtle Panel
Barely-there frosting, ideal for secondary containers.
bg: rgba(255,255,255,0.06)Medium Frost
Standard Panel
Primary container with visible glass depth and definition.
bg: rgba(255,255,255,0.10)Heavy Frost
Elevated Panel
High-emphasis container for modals and focused content.
bg: rgba(255,255,255,0.16)<div class="grid grid-cols-1 md:grid-cols-3 gap-6"> <!-- Light frost --> <div class="p-5 rounded-2xl" style="background: rgba(255,255,255,0.06); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid rgba(255,255,255,0.10);"> <p class="text-xs mb-2 font-mono" style="color: var(--color-primary);">Light Frost</p> <p class="font-semibold mb-1" style="color: var(--color-text);">Subtle Panel</p> <p class="text-sm mb-3" style="color: var(--color-text-muted);">Barely-there frosting, ideal for secondary containers.</p> <code class="text-xs font-mono" style="color: var(--color-text-muted);">bg: rgba(255,255,255,0.06)</code> </div> <!-- Medium frost --> <div class="p-5 rounded-2xl" style="background: rgba(255,255,255,0.10); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid rgba(255,255,255,0.15);"> <p class="text-xs mb-2 font-mono" style="color: var(--color-secondary);">Medium Frost</p> <p class="font-semibold mb-1" style="color: var(--color-text);">Standard Panel</p> <p class="text-sm mb-3" style="color: var(--color-text-muted);">Primary container with visible glass depth and definition.</p> <code class="text-xs font-mono" style="color: var(--color-text-muted);">bg: rgba(255,255,255,0.10)</code> </div> <!-- Heavy frost --> <div class="p-5 rounded-2xl" style="background: rgba(255,255,255,0.16); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid rgba(255,255,255,0.22);"> <p class="text-xs mb-2 font-mono" style="color: var(--color-accent);">Heavy Frost</p> <p class="font-semibold mb-1" style="color: var(--color-text);">Elevated Panel</p> <p class="text-sm mb-3" style="color: var(--color-text-muted);">High-emphasis container for modals and focused content.</p> <code class="text-xs font-mono" style="color: var(--color-text-muted);">bg: rgba(255,255,255,0.16)</code> </div> </div>
Tabs
[Alpine]Glassmorphism builds depth through stacked translucent layers. Each panel reveals what lies beneath, creating a sense of physical space in a flat medium.
<div x-data="{ tab: 'layers' }"> <div class="flex gap-2 mb-6" style="border-bottom: 1px solid var(--color-border); padding-bottom: 0.75rem;"> for _, t := range []struct{ id, label string }{ {"layers", "Layers"}, {"depth", "Depth"}, {"glow", "Glow"}, } { <button { templ.Attributes{ ":class": "tab==='" + t.id + "' ? 'glass-tab glass-tab-active' : 'glass-tab'", "@click": "tab='" + t.id + "'", }... } >{ t.label }</button> } </div> <div x-show="tab==='layers'"> <p class="text-sm" style="color: var(--color-text-muted);">Glassmorphism builds depth through stacked translucent layers. Each panel reveals what lies beneath, creating a sense of physical space in a flat medium.</p> </div> <div x-show="tab==='depth'" style="display: none;"> <p class="text-sm" style="color: var(--color-text-muted);">Blur intensity creates visual hierarchy. Foreground panels use heavy frost (16-24px blur), while background elements use subtle frost (4-8px). The eye focuses on what is sharpest.</p> </div> <div x-show="tab==='glow'" style="display: none;"> <p class="text-sm" style="color: var(--color-text-muted);">Gradient glows serve as ambient lighting. Soft radial gradients behind panels simulate light sources, giving the interface a luminous, ethereal quality.</p> </div> </div>
Alerts & Notices
Info
Backdrop-filter requires Chrome 76+, Firefox 103+, or Safari 9+.
Success
Theme applied successfully. All panels updated.
Warning
Heavy blur effects may impact performance on older GPUs.
Inline Edit
[HTMX]Click the value below to edit it in place. Uses hx-get to load an edit form and hx-post to save.
Project Name
Aurora Dashboard
<div id="glass-editable"> <div class="flex items-center justify-between"> <div> <p class="text-xs" style="color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.08em;">Project Name</p> <p class="text-lg font-semibold mt-1" style="color: var(--color-text);">Aurora Dashboard</p> </div> <button class="glass-btn-ghost px-3 py-1.5 text-xs" hx-get="/guides/glass/edit-field" hx-target="#glass-editable" hx-swap="innerHTML" >Edit</button> </div> </div>
Modal (x-transition)
[Alpine]The modal overlay uses x-transition directives for blur-in animation. The scrim itself also uses backdrop-filter.
Frosted Dialog
This overlay uses backdrop-filter: blur() on both the modal panel and the scrim.
<div x-data="{ open: false }"> <button class="glass-btn-primary px-4 py-2 text-sm" { templ.Attributes{"@click": "open = true"}... }> Open Modal </button> <div x-show="open" class="fixed inset-0 flex items-center justify-center z-50" style="backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); background: rgba(0,0,0,0.5);" { templ.Attributes{ "x-transition:enter": "transition ease-out duration-200", "x-transition:enter-start": "opacity-0", "x-transition:enter-end": "opacity-100", "x-transition:leave": "transition ease-in duration-150", "x-transition:leave-start": "opacity-100", "x-transition:leave-end": "opacity-0", "@click.self": "open = false", }... } > <div class="glass-panel p-8 max-w-md w-full mx-4"> <h3 class="text-lg font-semibold mb-2" style="color: var(--color-text);">Frosted Dialog</h3> <p class="text-sm mb-6" style="color: var(--color-text-muted);"> This overlay uses backdrop-filter: blur() on both the modal panel and the scrim. </p> <button class="glass-btn-primary px-4 py-2 text-sm" { templ.Attributes{"@click": "open = false"}... }>Close</button> </div> </div> </div>