π The Problem
You've built a beautiful app with shadcn/ui. Now you want to add glassmorphism effects β that gorgeous frosted glass look from iOS and macOS. Your options?
- π CSS libraries β No React components, manual integration
- π Full UI frameworks β Requires complete project migration
- βοΈ Custom components β Build and maintain everything yourself
What if there was a better way?
β¨ Introducing shadcn-glass-ui
shadcn-glass-ui is a glassmorphism component library that installs on top of existing shadcn/ui projects with zero migration required. Think of it as shadcn/ui's glass-themed sibling.
# Add to your existing shadcn/ui project
npx shadcn@latest add @shadcn-glass-ui/button-glass
# Use alongside your existing components
import { Button } from '@/components/ui/button';
import { ButtonGlass } from '@/components/glass/ui/button-glass';
π― Key Features
- π 100% shadcn/ui Compatible β Same APIs, same CLI, same patterns. Drop-in installation.
- π Progressive Enhancement β MVP on base components β glassmorphism β custom branding
- π¨ 57 Production-Ready Components β Core UI, Atomic, Composite, Sections, Specialized
- π§ Listed on registry.directory β Official shadcn CLI support
- π 3-Layer Token System β Zero hardcoded colors, create themes in ~15 lines
- π 3 Built-in Themes β Glass (dark), Light, Aurora (gradient)
- π€ AI-First Design β Context7 MCP, Claude Code, GitHub Copilot, GPT
- βΏ WCAG 2.1 AA β Full accessibility, 44px touch targets
- β‘ Modern Stack β React 19.2, TypeScript 5.9, Tailwind v4.1, Vite 7
- π¦ Tree-Shakeable β Import only what you need
- π§ͺ 1,500+ Tests β 99.5% pass rate (visual regression, compliance, unit)
π Drop-in Compatibility: The Game Changer
No migration required. shadcn-glass-ui enables a progressive enhancement workflow:
ποΈ Phase 1: Build MVP with base components
β shadcn/ui β fast start, validate ideas
π¨ Phase 2: Add glassmorphism effects
β shadcn-glass-ui β visual upgrade without rewrites
π§ Phase 3: Custom branding
β 3-layer token system β brand theme in ~15 lines
Perfect for:
- Startups β Quick MVP β polish design later
- Agencies β Template project β customize per client
- Enterprise β Prototype with shadcn/ui β production-ready with branding
- Freelancers β One codebase β different visual styles per client
Works Alongside Your Existing Code
shadcn-glass-ui components live side-by-side with shadcn/ui:
// β
Your existing shadcn/ui components keep working
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
// β
Glass variants install separately
import { ButtonGlass } from '@/components/glass/ui/button-glass';
import { InputGlass } from '@/components/glass/ui/input-glass';
function LoginForm() {
return (
<form className="space-y-4">
{/* Standard shadcn/ui */}
<Input placeholder="Email" />
<Button variant="outline">Standard button</Button>
{/* Glass variants with effects */}
<InputGlass placeholder="Password" type="password" />
<ButtonGlass variant="primary">Login with glass β¨</ButtonGlass>
</form>
);
}
API Compatibility
v2.0.0 achieves 100% API parity with shadcn/ui:
| Component | shadcn/ui | shadcn-glass-ui v2.0 | Compatible |
|---|---|---|---|
| Button | variant="default" |
variant="default" |
β 100% |
| Toggle |
pressed, onPressedChange
|
pressed, onPressedChange
|
β 100% |
| Slider |
value: number[], onValueChange
|
value: number[], onValueChange
|
β 100% |
| ComboBox |
value, onValueChange
|
value, onValueChange
|
β 100% |
Same everything:
- β
Props:
variant,size,className - β
Callbacks:
onValueChange,onPressedChange - β
asChildpattern for polymorphic rendering - β
CLI installation via
npx shadcn add
Bonus features:
- π¨ Built-in glassmorphism effects
- βοΈ Additional props:
loading,icon,intensity - π§© Compound Components API for complex widgets
π¦ Installation: Two Ways
Option 1: shadcn CLI (Recommended)
Now listed on registry.directory!
Step 1: Add registry to components.json:
{
"registries": {
"@shadcn-glass-ui": {
"url": "https://raw.githubusercontent.com/Yhooi2/shadcn-glass-ui-library/main/public/r"
}
}
}
Step 2: Install components:
# One command per component
npx shadcn@latest add @shadcn-glass-ui/button-glass
npx shadcn@latest add @shadcn-glass-ui/input-glass
npx shadcn@latest add @shadcn-glass-ui/modal-glass
# Or multiple at once
npx shadcn@latest add @shadcn-glass-ui/button-glass @shadcn-glass-ui/input-glass
Why CLI?
- β Minimal bundle β only what you use
- β Code lives in your project β full control
- β Easy to customize
- β No npm dependency
Option 2: Full Package (npm)
npm install shadcn-glass-ui
Quick start:
import { ButtonGlass, InputGlass, ThemeProvider } from 'shadcn-glass-ui';
import 'shadcn-glass-ui/dist/styles.css';
function App() {
return (
<ThemeProvider defaultTheme="glass">
<div className="p-8 space-y-4">
<ButtonGlass variant="primary" size="lg">
Click me! β¨
</ButtonGlass>
<InputGlass placeholder="Enter text..." />
</div>
</ThemeProvider>
);
}
Why npm?
- β One-command installation
- β Automatic updates
- β Tree-shaking included
π Revolutionary: 3-Layer Token System
What makes v2.0 special? Zero hardcoded color values. Every color is a CSS variable.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Component Tokens (280+) β
β --btn-primary-bg, --modal-surface, --input-border β
β β automatically inherit from β
β Semantic Tokens (~15 per theme) β
β --semantic-primary, --semantic-surface, --semantic-border β
β β reference β
β Primitive Tokens (225 OKLCH colors) β
β --oklch-purple-500, --oklch-slate-900 β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
How It Works
Layer 1 β 225 OKLCH colors, defined once for all themes:
:root {
--oklch-purple-500: oklch(0.55 0.25 270);
--oklch-slate-900: oklch(0.15 0.02 250);
--oklch-emerald-500: oklch(0.55 0.20 160);
--oklch-cyan-400: oklch(0.70 0.15 195);
/* ... 221 more colors */
}
Layer 2 β Each theme defines ~15 semantic tokens:
[data-theme='glass'] {
--semantic-primary: var(--oklch-purple-500);
--semantic-surface: var(--oklch-slate-900);
--semantic-text: var(--oklch-white-95);
--semantic-border: var(--oklch-slate-700);
--semantic-glow: var(--oklch-purple-500);
/* ... 10 more tokens */
}
Layer 3 β Components automatically inherit:
:root {
--btn-primary-bg: var(--semantic-primary);
--btn-primary-glow: var(--semantic-glow);
--modal-surface: var(--semantic-surface);
--input-border: var(--semantic-border);
/* ... 280+ component tokens */
}
Create a Custom Theme in ~15 Lines
Want a neon theme? Override only the semantic layer:
[data-theme='neon'] {
--semantic-primary: var(--oklch-cyan-400);
--semantic-secondary: var(--oklch-purple-400);
--semantic-surface: var(--oklch-black-10);
--semantic-surface-elevated: var(--oklch-slate-950);
--semantic-text: var(--oklch-white-98);
--semantic-text-muted: var(--oklch-slate-400);
--semantic-border: var(--oklch-cyan-500);
--semantic-border-subtle: var(--oklch-slate-800);
--semantic-glow: var(--oklch-cyan-400);
--semantic-success: var(--oklch-emerald-500);
--semantic-warning: var(--oklch-amber-500);
--semantic-destructive: var(--oklch-red-500);
--semantic-info: var(--oklch-blue-500);
}
Result:
- β All 57 components update automatically
- β Theme switching is instant β CSS only, no React re-renders
- β 280+ component tokens inherit without changes
Real-World Example: MVP to Production
Scenario: SaaS startup building an analytics dashboard.
Week 1-2: MVP with shadcn/ui
// Quick prototype with base components
import { Button, Input, Card } from '@/components/ui';
function Dashboard() {
return (
<div>
<Card>
<h2>Metrics</h2>
<Input placeholder="Search..." />
<Button>Export</Button>
</Card>
</div>
);
}
Week 3: Add glassmorphism
# One command β visual upgrade
npx shadcn@latest add @shadcn-glass-ui/card-glass
npx shadcn@latest add @shadcn-glass-ui/button-glass
npx shadcn@latest add @shadcn-glass-ui/input-glass
// Change only imports β APIs identical
import { ButtonGlass, InputGlass, CardGlass } from '@/components/glass/ui';
function Dashboard() {
return (
<div>
<CardGlass> {/* Now with blur and glow effects */}
<h2>Metrics</h2>
<InputGlass placeholder="Search..." />
<ButtonGlass>Export</ButtonGlass>
</CardGlass>
</div>
);
}
Week 4: Brand with corporate colors
/* 15 lines β entire company branded */
[data-theme='company'] {
--semantic-primary: var(--oklch-blue-600); /* Corp blue */
--semantic-secondary: var(--oklch-orange-500); /* Corp orange */
--semantic-surface: var(--oklch-slate-900); /* Dark background */
--semantic-glow: var(--oklch-blue-400); /* Blue glow */
/* ... 10 more tokens */
}
Result:
- β‘ 0 rewritten code β only import changes
- π¨ Full rebrand in 15 CSS lines
- π Idea to production in one month
Before and After
| Metric | v1.x (old) | v2.0 (token system) |
|---|---|---|
| Hardcoded OKLCH values | ~280 per theme | 0 |
| CSS variables per theme | ~85 | 296+ (auto-inherited) |
| Lines to create theme | ~280 | ~15 |
| Theme switching | React re-render | Instant CSS swap |
π€ AI-First: Built for AI Assistants
Modern developers use AI coding assistants (Claude, Copilot, ChatGPT). The problem? Most libraries are poorly indexed: implicit APIs, outdated docs in training data.
shadcn-glass-ui is optimized for AI:
| AI Tool | Integration | What it provides |
|---|---|---|
| Context7 MCP | Auto-indexed | 41 rules, auto-fetched current docs, version-aware |
| Claude Code | CLAUDE.md | 365-line project context, patterns, examples |
| GitHub Copilot | TypeScript strict + JSDoc | Accurate completions with inline examples |
| ChatGPT/GPT-4 | EXPORTS_MAP.json | Machine-readable component registry |
Example: Context7 MCP in Action
Context7 is a Model Context Protocol for indexing documentation. AI assistants query current documentation in real-time instead of relying on stale training data.
Typical workflow:
Developer: "Add a stepper to my checkout flow with 3 steps"
β Claude Code queries Context7 MCP for documentation
β Context7 returns current StepperGlass docs
β Claude sees: "compound API, linear mode for wizards, 3 variants"
β Claude generates correct code:
<StepperGlass.Root mode="linear" currentStep={step}>
<StepperGlass.Step value={0}>
<StepperGlass.Trigger>
<StepperGlass.Icon />
Shipping
</StepperGlass.Trigger>
<StepperGlass.Content>
<AddressForm />
</StepperGlass.Content>
</StepperGlass.Step>
<StepperGlass.Step value={1}>
<StepperGlass.Trigger>
<StepperGlass.Icon />
Payment
</StepperGlass.Trigger>
<StepperGlass.Content>
<PaymentForm />
</StepperGlass.Content>
</StepperGlass.Step>
<StepperGlass.Step value={2}>
<StepperGlass.Trigger>
<StepperGlass.Icon />
Confirmation
</StepperGlass.Trigger>
<StepperGlass.Content>
<OrderSummary />
</StepperGlass.Content>
</StepperGlass.Step>
</StepperGlass.Root>
Without Context7, AI would:
- Rely on outdated docs from training data
- Guess API names (maybe
stepinstead ofvalue?) - Miss the
linearmode for wizards - Forget
StepperGlass.Iconand other subcomponents
Decision Trees for AI
The repository includes decision trees β which component to use for specific tasks:
Need to display a metric?
ββ Single value β MetricCardGlass
ββ Compare multiple β MetricsGridGlass
ββ With trend (sparkline) β SparklineGlass
ββ Circular chart β CircularMetricGlass
Need a modal?
ββ Simple confirmation β AlertGlass
ββ Form with fields β ModalGlass.Root (compound)
ββ Toast notification β NotificationGlass
Rich JSDoc for All Components
Every component includes detailed JSDoc with examples:
/**
* Glass-styled button with glassmorphism effect
*
* @example
* // Primary button with loading state
* <ButtonGlass variant="primary" size="lg" loading>
* Loading...
* </ButtonGlass>
*
* @example
* // As link with React Router (polymorphic)
* <ButtonGlass asChild>
* <Link to="/profile">Profile</Link>
* </ButtonGlass>
*
* @example
* // With icon
* <ButtonGlass icon={<CheckIcon />} variant="ghost">
* Saved
* </ButtonGlass>
*
* @accessibility
* - Keyboard navigation (Enter, Space)
* - Focus visible ring (2px inner + 4px outer)
* - Touch target minimum 44x44px (Apple HIG)
* - Loading state disables interaction
*/
export const ButtonGlass: React.FC<ButtonGlassProps> = ({
variant = "default",
size = "md",
loading = false,
icon,
asChild = false,
...props
}) => { /* ... */ };
AI sees examples directly in types and generates correct code on the first try.
π¨ Components: 57 Production-Ready
shadcn-glass-ui provides 57 components across 6 categories:
| Category | Count | Description | Examples |
|---|---|---|---|
| Core UI | 18 | Essential building blocks | ButtonGlass, InputGlass, ModalGlass, TabsGlass, CheckboxGlass, SliderGlass |
| Atomic | 7 | Single-purpose components | SearchBoxGlass, ThemeToggleGlass, IconButtonGlass, StatItemGlass |
| Composite | 13 | Pre-built complex widgets | MetricCardGlass, AICardGlass, RepositoryCardGlass, UserInfoGlass |
| Sections | 7 | Full page sections | HeaderNavGlass, ProfileHeaderGlass, CareerStatsGlass, ProjectsListGlass |
| Specialized | 10 | Advanced components | SparklineGlass, StepperGlass (3 variants), RainbowProgressGlass |
| Primitives | 3 | Low-level primitives | TouchTarget, FormFieldWrapper, InteractiveCard |
Three Built-in Themes
- Glass (dark) β Classic glassmorphism with purple accents and glow effects
- Light β Clean minimal design with subtle glass effects
- Aurora β Vibrant gradients with aurora borealis-inspired colors
import { ThemeProvider, useTheme } from 'shadcn-glass-ui';
function ThemeSwitcher() {
const { theme, cycleTheme } = useTheme();
return (
<button onClick={cycleTheme}>
Current theme: {theme}
</button>
);
}
Compound Components API
Complex components use the Compound Components pattern for maximum flexibility:
<ModalGlass.Root open={isOpen} onOpenChange={setIsOpen}>
<ModalGlass.Overlay />
<ModalGlass.Content>
<ModalGlass.Header>
<ModalGlass.Title>Confirm Action</ModalGlass.Title>
<ModalGlass.Description>
This action cannot be undone
</ModalGlass.Description>
<ModalGlass.Close />
</ModalGlass.Header>
<ModalGlass.Body>
<p>Are you sure you want to delete this item?</p>
</ModalGlass.Body>
<ModalGlass.Footer>
<ButtonGlass variant="ghost" onClick={() => setIsOpen(false)}>
Cancel
</ButtonGlass>
<ButtonGlass variant="destructive" onClick={handleDelete}>
Delete
</ButtonGlass>
</ModalGlass.Footer>
</ModalGlass.Content>
</ModalGlass.Root>
Benefits:
- π§© Flexible composition β Skip Footer or add Description as needed
- π¦ Tree-shaking β Unused parts don't ship to production
- π Clear structure β DOM hierarchy visible without docs
Polymorphic Components (asChild)
All interactive components support the asChild pattern from Radix UI:
import { ButtonGlass } from 'shadcn-glass-ui';
import { Link } from 'react-router-dom';
// Render button as React Router Link
<ButtonGlass asChild variant="primary">
<Link to="/dashboard">Go to Dashboard</Link>
</ButtonGlass>
// Render button as anchor
<ButtonGlass asChild variant="ghost">
<a href="https://github.com" target="_blank" rel="noopener">
GitHub
</a>
</ButtonGlass>
// Render button as custom component
<ButtonGlass asChild>
<motion.button
whileHover={{ scale: 1.05 }}
whileTap={{ scale: 0.95 }}
>
Animated Button
</motion.button>
</ButtonGlass>
βΏ Accessibility First
All components comply with WCAG 2.1 Level AA:
- β Contrast β Minimum 4.5:1 for text
- β Keyboard β Full navigation via Tab, Enter, Arrow keys
- β Touch targets β Minimum 44Γ44px (Apple HIG)
- β Screen readers β Proper ARIA attributes and semantic HTML
- β Focus indicators β 2px inner + 4px outer ring
- β
Reduced motion β Auto-disables animations with
prefers-reduced-motion
Test Coverage: 1,500+ Automated Tests
| Category | Count | Tools | Pass Rate |
|---|---|---|---|
| Design System Compliance | 650+ | Vitest + custom matchers | 99.5% |
| Visual Regression | 580 | Playwright + screenshots | 99.5% |
| Unit Tests | 270+ | Vitest | 99.5% |
Design System Compliance verifies:
- All components use tokens (no hardcoded values)
- Touch targets minimum 44Γ44px
- Color contrast 4.5:1+
- Correct compound component structure
Visual Regression catches:
- Unintended visual changes
- Theme switching bugs
- Responsive design issues
π οΈ CLI Utilities
shadcn-glass-ui includes a CLI for quick reference:
# Component info (fuzzy search)
npx shadcn-glass-ui info button
npx shadcn-glass-ui info modal
# List all components
npx shadcn-glass-ui list
# Filter by category
npx shadcn-glass-ui list --category=core
npx shadcn-glass-ui list --category=composite
πΊοΈ Roadmap
Coming in future releases:
- π¨ 10+ new components (DatePicker, Calendar, Command Palette)
- π Additional themes (Cyberpunk, Nord, Dracula)
- π± Mobile optimization enhancements
- π Figma plugins (export themes)
- π€ Extended Context7 integration (code actions)
π Resources
- π Live Demo: Storybook
- π» GitHub: Repository
- π¦ npm: Package
- π Documentation:
- π€ Context7: Auto-indexing
π€ Contributing
shadcn-glass-ui is open source (MIT) and we welcome contributions!
- π Found a bug? Report it
- π‘ Have an idea? Start a discussion
- π§ Want to contribute? Contributing Guide
β Support the Project
If you find shadcn-glass-ui useful:
- Star the GitHub repository
- Share this article
- Try it in your next project
π― What Makes This Different?
shadcn-glass-ui solves four key problems:
"How do I add glassmorphism without rewriting my project?"
β Drop-in compatibility with shadcn/ui, CLI installation"How do I quickly go from MVP to production-ready design?"
β Progressive enhancement: base components β glassmorphism β branding"How do I create themes without copy-pasting hundreds of values?"
β 3-layer token system, new theme in ~15 lines"How do I make my library AI-assistant friendly?"
β Context7 MCP, rich JSDoc, decision trees
Typical workflow:
Week 1-2: Prototype with shadcn/ui
β
Week 3: Add glassmorphism (npm install)
β
Week 4: Custom brand theme (15 CSS lines)
β
Production-ready in one month π
π¬ Let's Connect!
I'd love to hear your feedback! Drop a comment below or reach out:
- GitHub: @Yhooi2
- Twitter: Share your builds with #shadcnglassui
Thanks for reading! Happy coding! πβ¨
Found this helpful? Follow for more articles on React, TypeScript, and UI development.

Top comments (0)