shadcn-glass-ui 1.0.11 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +213 -0
- package/README.md +174 -17
- package/context7.json +58 -0
- package/dist/cli/index.cjs +470 -0
- package/dist/cli/index.cjs.map +1 -0
- package/dist/cli/index.d.ts +18 -0
- package/dist/cli/index.js +469 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/components.cjs +4 -4
- package/dist/components.d.ts +153 -22
- package/dist/components.js +2 -2
- package/dist/hooks.cjs +2 -2
- package/dist/index.cjs +872 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +0 -2390
- package/dist/index.js +844 -3
- package/dist/index.js.map +1 -1
- package/dist/r/ai-card-glass.json +5 -12
- package/dist/r/avatar-glass.json +5 -15
- package/dist/r/circular-metric-glass.json +5 -11
- package/dist/r/circular-progress-glass.json +5 -12
- package/dist/r/combobox-glass.json +5 -13
- package/dist/r/flag-alert-glass.json +5 -11
- package/dist/r/flags-section-glass.json +5 -12
- package/dist/r/insight-card-glass.json +17 -0
- package/dist/r/interactive-card.json +5 -12
- package/dist/r/language-bar-glass.json +5 -11
- package/dist/r/metric-card-glass.json +6 -13
- package/dist/r/metrics-grid-glass.json +5 -11
- package/dist/r/modal-glass.json +5 -15
- package/dist/r/progress-glass.json +5 -13
- package/dist/r/registry.json +20 -2
- package/dist/r/segmented-control-glass.json +5 -11
- package/dist/r/sparkline-glass.json +17 -0
- package/dist/r/stepper-glass.json +33 -0
- package/dist/r/tabs-glass.json +4 -9
- package/dist/r/trust-score-card-glass.json +5 -12
- package/dist/r/year-card-glass.json +5 -13
- package/dist/shadcn-glass-ui.css +1 -1
- package/dist/{theme-context-XtasSxRT.cjs → theme-context-CVW50BKW.cjs} +2 -2
- package/dist/{theme-context-XtasSxRT.cjs.map → theme-context-CVW50BKW.cjs.map} +1 -1
- package/dist/themes.cjs +1 -1
- package/dist/trust-score-card-glass-BcZbul0P.js +26895 -0
- package/dist/trust-score-card-glass-BcZbul0P.js.map +1 -0
- package/dist/trust-score-card-glass-r3qM09Jp.cjs +27689 -0
- package/dist/trust-score-card-glass-r3qM09Jp.cjs.map +1 -0
- package/dist/{use-focus-BbpE2qGq.cjs → use-focus-ZE8ozmZE.cjs} +2 -2
- package/dist/{use-focus-BbpE2qGq.cjs.map → use-focus-ZE8ozmZE.cjs.map} +1 -1
- package/dist/{use-wallpaper-tint-CIqtoETa.cjs → use-wallpaper-tint-BuS80tbN.cjs} +2 -2
- package/dist/{use-wallpaper-tint-CIqtoETa.cjs.map → use-wallpaper-tint-BuS80tbN.cjs.map} +1 -1
- package/dist/{utils-CGCOTvxT.js → utils-CcyeqpKQ.js} +1 -1
- package/dist/{utils-CGCOTvxT.js.map → utils-CcyeqpKQ.js.map} +1 -1
- package/dist/{utils-CriE74ig.cjs → utils-DLXayspX.cjs} +2 -2
- package/dist/{utils-CriE74ig.cjs.map → utils-DLXayspX.cjs.map} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +1 -1
- package/docs/AI_IMPROVEMENTS_COMPLETE.md +574 -0
- package/docs/AI_USAGE.md +1328 -0
- package/docs/API_PATTERNS_COMPARISON.md +418 -0
- package/docs/BEST_PRACTICES.md +800 -0
- package/docs/COMPLIANCE_CHECKLIST.md +307 -0
- package/docs/COMPLIANCE_TESTING.md +436 -0
- package/docs/COMPONENTS_CATALOG.md +1076 -0
- package/docs/CSS_VARIABLES_AUDIT.md +306 -0
- package/docs/CSS_VARIABLES_REFACTORING_PLAN.md +330 -0
- package/docs/EXPORTS_MAP.json +875 -0
- package/docs/EXPORTS_STRUCTURE.md +729 -0
- package/docs/GETTING_STARTED.md +655 -0
- package/docs/METRIC_CARD_API_REDESIGN.md +354 -0
- package/docs/PRIMITIVE_MAPPING.md +404 -0
- package/docs/PUBLISHING.md +593 -0
- package/docs/REGISTRY_SUMMARY.md +96 -0
- package/docs/REGISTRY_USAGE.md +339 -0
- package/docs/SECURITY.md +117 -0
- package/docs/THEME_CREATION_GUIDE.md +455 -0
- package/docs/TOKEN_ARCHITECTURE.md +365 -0
- package/docs/announcements/v1.0.5-devto.md +363 -0
- package/docs/announcements/v1.0.5-reddit.md +115 -0
- package/docs/announcements/v1.0.5-twitter.md +70 -0
- package/docs/api/README.md +725 -0
- package/docs/api/functions/ThemeProvider.md +21 -0
- package/docs/api/functions/cn.md +27 -0
- package/docs/api/functions/getNextTheme.md +21 -0
- package/docs/api/functions/getThemeConfig.md +21 -0
- package/docs/api/functions/useFocus.md +53 -0
- package/docs/api/functions/useHover.md +47 -0
- package/docs/api/functions/useResponsive.md +31 -0
- package/docs/api/functions/useTheme.md +15 -0
- package/docs/api/functions/useWallpaperTint.md +36 -0
- package/docs/api/globals.md +139 -0
- package/docs/api/interfaces/AlertGlassProps.md +131 -0
- package/docs/api/interfaces/AvatarGlassProps.md +114 -0
- package/docs/api/interfaces/BadgeGlassProps.md +118 -0
- package/docs/api/interfaces/ButtonGlassProps.md +179 -0
- package/docs/api/interfaces/CheckboxGlassProps.md +125 -0
- package/docs/api/interfaces/DropdownGlassProps.md +123 -0
- package/docs/api/interfaces/DropdownItem.md +53 -0
- package/docs/api/interfaces/GlassCardProps.md +151 -0
- package/docs/api/interfaces/InputGlassProps.md +169 -0
- package/docs/api/interfaces/NotificationGlassProps.md +67 -0
- package/docs/api/interfaces/ProgressGlassProps.md +49 -0
- package/docs/api/interfaces/SkeletonGlassProps.md +41 -0
- package/docs/api/interfaces/SliderGlassProps.md +107 -0
- package/docs/api/interfaces/TabItem.md +25 -0
- package/docs/api/interfaces/ThemeConfig.md +25 -0
- package/docs/api/interfaces/ThemeContextValue.md +47 -0
- package/docs/api/interfaces/ToggleGlassProps.md +59 -0
- package/docs/api/interfaces/TooltipGlassProps.md +119 -0
- package/docs/api/type-aliases/AlertType.md +11 -0
- package/docs/api/type-aliases/AlertVariant.md +11 -0
- package/docs/api/type-aliases/AvatarSize.md +11 -0
- package/docs/api/type-aliases/AvatarStatus.md +13 -0
- package/docs/api/type-aliases/BadgeSize.md +11 -0
- package/docs/api/type-aliases/BadgeVariant.md +11 -0
- package/docs/api/type-aliases/ButtonGlassSize.md +11 -0
- package/docs/api/type-aliases/ButtonGlassVariant.md +11 -0
- package/docs/api/type-aliases/DropdownAlign.md +11 -0
- package/docs/api/type-aliases/GlowType.md +11 -0
- package/docs/api/type-aliases/InputGlassSize.md +11 -0
- package/docs/api/type-aliases/IntensityType.md +11 -0
- package/docs/api/type-aliases/ModalSize.md +11 -0
- package/docs/api/type-aliases/NotificationType.md +11 -0
- package/docs/api/type-aliases/PaddingType.md +11 -0
- package/docs/api/type-aliases/ProgressGradient.md +11 -0
- package/docs/api/type-aliases/ProgressSize.md +11 -0
- package/docs/api/type-aliases/SkeletonVariant.md +11 -0
- package/docs/api/type-aliases/Theme.md +11 -0
- package/docs/api/type-aliases/ToggleGlassSize.md +11 -0
- package/docs/api/type-aliases/TooltipPosition.md +11 -0
- package/docs/api/variables/AICardGlass.md +11 -0
- package/docs/api/variables/AlertGlass.md +11 -0
- package/docs/api/variables/AvatarGlass.md +11 -0
- package/docs/api/variables/BadgeGlass.md +11 -0
- package/docs/api/variables/BaseProgressGlass.md +11 -0
- package/docs/api/variables/ButtonGlass.md +11 -0
- package/docs/api/variables/CareerStatsGlass.md +11 -0
- package/docs/api/variables/CareerStatsHeaderGlass.md +11 -0
- package/docs/api/variables/CheckboxGlass.md +11 -0
- package/docs/api/variables/CircularMetricGlass.md +22 -0
- package/docs/api/variables/CircularProgressGlass.md +11 -0
- package/docs/api/variables/ComboBoxGlass.md +27 -0
- package/docs/api/variables/ContributionMetricsGlass.md +11 -0
- package/docs/api/variables/DropdownGlass.md +11 -0
- package/docs/api/variables/ExpandableHeaderGlass.md +11 -0
- package/docs/api/variables/FlagAlertGlass.md +11 -0
- package/docs/api/variables/FlagsSectionGlass.md +11 -0
- package/docs/api/variables/FormFieldWrapper.md +44 -0
- package/docs/api/variables/GlassCard.md +11 -0
- package/docs/api/variables/HeaderBrandingGlass.md +11 -0
- package/docs/api/variables/HeaderNavGlass.md +11 -0
- package/docs/api/variables/IconButtonGlass.md +11 -0
- package/docs/api/variables/InputGlass.md +11 -0
- package/docs/api/variables/InteractiveCard.md +45 -0
- package/docs/api/variables/LanguageBarGlass.md +11 -0
- package/docs/api/variables/MetricCardGlass.md +11 -0
- package/docs/api/variables/MetricsGridGlass.md +11 -0
- package/docs/api/variables/ModalGlass.md +72 -0
- package/docs/api/variables/NotificationGlass.md +11 -0
- package/docs/api/variables/PopoverGlass.md +11 -0
- package/docs/api/variables/ProfileAvatarGlass.md +11 -0
- package/docs/api/variables/ProfileHeaderGlass.md +11 -0
- package/docs/api/variables/ProgressGlass.md +11 -0
- package/docs/api/variables/ProjectsListGlass.md +11 -0
- package/docs/api/variables/RainbowProgressGlass.md +11 -0
- package/docs/api/variables/RepositoryCardGlass.md +11 -0
- package/docs/api/variables/RepositoryHeaderGlass.md +11 -0
- package/docs/api/variables/RepositoryMetadataGlass.md +11 -0
- package/docs/api/variables/SearchBoxGlass.md +11 -0
- package/docs/api/variables/SegmentedControlGlass.md +11 -0
- package/docs/api/variables/SkeletonGlass.md +11 -0
- package/docs/api/variables/SliderGlass.md +11 -0
- package/docs/api/variables/SortDropdownGlass.md +11 -0
- package/docs/api/variables/StatItemGlass.md +11 -0
- package/docs/api/variables/StatusIndicatorGlass.md +11 -0
- package/docs/api/variables/THEMES.md +11 -0
- package/docs/api/variables/THEME_CONFIG.md +11 -0
- package/docs/api/variables/TabsGlass.md +52 -0
- package/docs/api/variables/ThemeToggleGlass.md +11 -0
- package/docs/api/variables/ToggleGlass.md +11 -0
- package/docs/api/variables/TooltipGlass.md +11 -0
- package/docs/api/variables/TouchTarget.md +35 -0
- package/docs/api/variables/TrustScoreCardGlass.md +11 -0
- package/docs/api/variables/TrustScoreDisplayGlass.md +11 -0
- package/docs/api/variables/UserInfoGlass.md +11 -0
- package/docs/api/variables/UserStatsLineGlass.md +11 -0
- package/docs/api/variables/YearCardGlass.md +11 -0
- package/docs/api/variables/alertVariants.md +21 -0
- package/docs/api/variables/avatarSizes.md +21 -0
- package/docs/api/variables/badgeVariants.md +21 -0
- package/docs/api/variables/buttonGlassVariants.md +21 -0
- package/docs/api/variables/cardIntensity.md +21 -0
- package/docs/api/variables/dropdownAlign.md +21 -0
- package/docs/api/variables/inputVariants.md +21 -0
- package/docs/api/variables/modalSizes.md +21 -0
- package/docs/api/variables/notificationVariants.md +21 -0
- package/docs/api/variables/progressSizes.md +21 -0
- package/docs/api/variables/shadcnAlertVariants.md +21 -0
- package/docs/api/variables/shadcnBadgeVariants.md +21 -0
- package/docs/api/variables/shadcnButtonVariants.md +21 -0
- package/docs/api/variables/skeletonVariants.md +21 -0
- package/docs/api/variables/statusSizes.md +21 -0
- package/docs/api/variables/toggleSizes.md +21 -0
- package/docs/api/variables/tooltipPositions.md +21 -0
- package/docs/design-system/UI_DESIGN.md +628 -0
- package/docs/migration/CSS_VARIABLES_MIGRATION_2.0.md +325 -0
- package/docs/migration/modal-glass-compound-api.md +458 -0
- package/docs/migration/select-to-combobox.md +386 -0
- package/docs/migration/tabs-glass-compound-api.md +579 -0
- package/docs/technical/DEPENDENCIES.md +291 -0
- package/docs/visual-testing-guide.md +324 -0
- package/package.json +16 -3
- package/dist/trust-score-card-glass-CNcQveNY.cjs +0 -8231
- package/dist/trust-score-card-glass-CNcQveNY.cjs.map +0 -1
- package/dist/trust-score-card-glass-CowcDyxH.js +0 -7795
- package/dist/trust-score-card-glass-CowcDyxH.js.map +0 -1
|
@@ -0,0 +1,655 @@
|
|
|
1
|
+
# Getting Started with shadcn-glass-ui
|
|
2
|
+
|
|
3
|
+
Complete guide to integrating shadcn-glass-ui into your React application.
|
|
4
|
+
|
|
5
|
+
## 📋 Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Prerequisites](#prerequisites)
|
|
8
|
+
- [Installation](#installation)
|
|
9
|
+
- [Project Setup](#project-setup)
|
|
10
|
+
- [Theme Configuration](#theme-configuration)
|
|
11
|
+
- [First Component](#first-component)
|
|
12
|
+
- [Common Patterns](#common-patterns)
|
|
13
|
+
- [Next Steps](#next-steps)
|
|
14
|
+
|
|
15
|
+
## Prerequisites
|
|
16
|
+
|
|
17
|
+
Before starting, ensure you have:
|
|
18
|
+
|
|
19
|
+
- **Node.js**: 20.16+, 22.19+, or 24+
|
|
20
|
+
- **React**: 18.0+ or 19.0+
|
|
21
|
+
- **Tailwind CSS**: 4.1+ (or will be installed)
|
|
22
|
+
- **TypeScript**: 5.0+ (recommended but optional)
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
### Option 1: shadcn CLI (Recommended)
|
|
27
|
+
|
|
28
|
+
The easiest way to add components to an existing shadcn/ui project:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npx shadcn@latest add @shadcn-glass-ui/button
|
|
32
|
+
npx shadcn@latest add @shadcn-glass-ui/input
|
|
33
|
+
npx shadcn@latest add @shadcn-glass-ui/modal
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
This will:
|
|
37
|
+
|
|
38
|
+
- Download component files
|
|
39
|
+
- Install dependencies
|
|
40
|
+
- Configure Tailwind
|
|
41
|
+
- Add necessary utilities
|
|
42
|
+
|
|
43
|
+
### Option 2: NPM Package
|
|
44
|
+
|
|
45
|
+
Install from the public npm registry:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npm install shadcn-glass-ui
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
For TypeScript projects, types are included automatically.
|
|
52
|
+
|
|
53
|
+
### Option 3: Manual Installation
|
|
54
|
+
|
|
55
|
+
Copy components directly from the repository:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Clone the repository
|
|
59
|
+
git clone https://github.com/Yhooi2/shadcn-glass-ui-library.git
|
|
60
|
+
|
|
61
|
+
# Copy desired components
|
|
62
|
+
cp shadcn-glass-ui-library/src/components/glass/ui/button-glass.tsx ./src/components/ui/
|
|
63
|
+
cp shadcn-glass-ui-library/src/lib/variants/button-glass-variants.ts ./src/lib/variants/
|
|
64
|
+
cp shadcn-glass-ui-library/src/lib/utils.ts ./src/lib/
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Project Setup
|
|
68
|
+
|
|
69
|
+
### 1. Install Dependencies
|
|
70
|
+
|
|
71
|
+
If not using the shadcn CLI, install peer dependencies:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
npm install class-variance-authority clsx tailwind-merge
|
|
75
|
+
npm install -D tailwindcss@4.1
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Optional dependencies for full feature set:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
npm install @radix-ui/react-dialog @radix-ui/react-dropdown-menu
|
|
82
|
+
npm install @radix-ui/react-tabs @radix-ui/react-tooltip
|
|
83
|
+
npm install lucide-react # For icons
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 2. Configure Tailwind CSS
|
|
87
|
+
|
|
88
|
+
Update your `tailwind.config.ts`:
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
import type { Config } from 'tailwindcss';
|
|
92
|
+
|
|
93
|
+
export default {
|
|
94
|
+
content: [
|
|
95
|
+
'./src/**/*.{js,ts,jsx,tsx}',
|
|
96
|
+
'./node_modules/shadcn-glass-ui/dist/**/*.{js,ts,jsx,tsx}', // If using npm package
|
|
97
|
+
],
|
|
98
|
+
theme: {
|
|
99
|
+
extend: {
|
|
100
|
+
backdropBlur: {
|
|
101
|
+
xs: '4px',
|
|
102
|
+
sm: '8px',
|
|
103
|
+
md: '16px',
|
|
104
|
+
lg: '24px',
|
|
105
|
+
xl: '32px',
|
|
106
|
+
},
|
|
107
|
+
borderRadius: {
|
|
108
|
+
lg: '12px',
|
|
109
|
+
xl: '16px',
|
|
110
|
+
'2xl': '20px',
|
|
111
|
+
'3xl': '24px',
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
plugins: [],
|
|
116
|
+
} satisfies Config;
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### 3. Add CSS Variables
|
|
120
|
+
|
|
121
|
+
Create or update your `globals.css`:
|
|
122
|
+
|
|
123
|
+
```css
|
|
124
|
+
@tailwind base;
|
|
125
|
+
@tailwind components;
|
|
126
|
+
@tailwind utilities;
|
|
127
|
+
|
|
128
|
+
/* Import shadcn-glass-ui styles (if using npm package) */
|
|
129
|
+
@import 'shadcn-glass-ui/dist/styles.css';
|
|
130
|
+
|
|
131
|
+
/* Or define variables manually */
|
|
132
|
+
@layer base {
|
|
133
|
+
:root {
|
|
134
|
+
/* Blur tokens */
|
|
135
|
+
--blur-sm: 8px;
|
|
136
|
+
--blur-md: 16px;
|
|
137
|
+
--blur-lg: 24px;
|
|
138
|
+
--blur-xl: 32px;
|
|
139
|
+
|
|
140
|
+
/* Glass theme (dark) */
|
|
141
|
+
--card-subtle-bg: rgba(255, 255, 255, 0.08);
|
|
142
|
+
--card-medium-bg: rgba(255, 255, 255, 0.15);
|
|
143
|
+
--card-strong-bg: rgba(255, 255, 255, 0.2);
|
|
144
|
+
--card-medium-border: rgba(255, 255, 255, 0.15);
|
|
145
|
+
|
|
146
|
+
/* Text shadow for glass readability */
|
|
147
|
+
--text-shadow-glass: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.2);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/* Light theme overrides */
|
|
151
|
+
.theme-light {
|
|
152
|
+
--card-subtle-bg: rgba(0, 0, 0, 0.03);
|
|
153
|
+
--card-medium-bg: rgba(0, 0, 0, 0.05);
|
|
154
|
+
--card-strong-bg: rgba(0, 0, 0, 0.08);
|
|
155
|
+
--card-medium-border: rgba(0, 0, 0, 0.1);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/* Aurora theme (gradient) */
|
|
159
|
+
.theme-aurora {
|
|
160
|
+
--card-subtle-bg: rgba(255, 255, 255, 0.1);
|
|
161
|
+
--card-medium-bg: rgba(255, 255, 255, 0.18);
|
|
162
|
+
--card-strong-bg: rgba(255, 255, 255, 0.25);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### 4. Create Utilities File
|
|
168
|
+
|
|
169
|
+
Create `src/lib/utils.ts` (if not exists):
|
|
170
|
+
|
|
171
|
+
```typescript
|
|
172
|
+
import { clsx, type ClassValue } from 'clsx';
|
|
173
|
+
import { twMerge } from 'tailwind-merge';
|
|
174
|
+
|
|
175
|
+
export function cn(...inputs: ClassValue[]) {
|
|
176
|
+
return twMerge(clsx(inputs));
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Understanding the Token System (v2.0.0+)
|
|
181
|
+
|
|
182
|
+
shadcn-glass-ui uses a **3-layer token architecture** that eliminates hardcoded colors and enables
|
|
183
|
+
rapid theme creation.
|
|
184
|
+
|
|
185
|
+
### 3-Layer Architecture
|
|
186
|
+
|
|
187
|
+
```
|
|
188
|
+
Layer 3: Component Tokens (--btn-primary-bg, --input-border, --modal-bg)
|
|
189
|
+
↓ references
|
|
190
|
+
Layer 2: Semantic Tokens (--semantic-primary, --semantic-surface, --semantic-text)
|
|
191
|
+
↓ references
|
|
192
|
+
Layer 1: Primitive Tokens (--oklch-purple-500, --oklch-white-8, --oklch-slate-800)
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
**What this means for you:**
|
|
196
|
+
|
|
197
|
+
1. **No hardcoded colors** - All colors use CSS variables
|
|
198
|
+
2. **Easy customization** - Change theme by updating semantic tokens
|
|
199
|
+
3. **Consistency** - All components automatically sync with theme changes
|
|
200
|
+
4. **Fast theme creation** - Create production-ready themes in 15 minutes
|
|
201
|
+
|
|
202
|
+
### Token Layers Explained
|
|
203
|
+
|
|
204
|
+
**Layer 1: Primitives** (`src/styles/tokens/oklch-primitives.css`)
|
|
205
|
+
|
|
206
|
+
- 207 OKLCH color primitives
|
|
207
|
+
- Single source of truth for all colors
|
|
208
|
+
- Shared across all themes (glass, light, aurora)
|
|
209
|
+
|
|
210
|
+
Example:
|
|
211
|
+
|
|
212
|
+
```css
|
|
213
|
+
--oklch-purple-500: oklch(66.6% 0.159 303);
|
|
214
|
+
--oklch-white-8: oklch(100% 0 0 / 0.08);
|
|
215
|
+
--oklch-emerald-400: oklch(76.5% 0.147 163);
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
**Layer 2: Semantic Tokens** (per-theme in `src/styles/themes/*.css`)
|
|
219
|
+
|
|
220
|
+
- Role-based color names
|
|
221
|
+
- Describe usage, not appearance
|
|
222
|
+
- Defined per theme (glass.css, light.css, aurora.css)
|
|
223
|
+
|
|
224
|
+
Example:
|
|
225
|
+
|
|
226
|
+
```css
|
|
227
|
+
/* glass.css */
|
|
228
|
+
--semantic-primary: var(--oklch-purple-500);
|
|
229
|
+
--semantic-surface: var(--oklch-white-8);
|
|
230
|
+
--semantic-text: var(--oklch-white-90);
|
|
231
|
+
|
|
232
|
+
/* light.css */
|
|
233
|
+
--semantic-primary: var(--oklch-violet-600);
|
|
234
|
+
--semantic-surface: var(--oklch-slate-100-80);
|
|
235
|
+
--semantic-text: var(--oklch-slate-800);
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
**Layer 3: Component Tokens** (per-theme in `src/styles/themes/*.css`)
|
|
239
|
+
|
|
240
|
+
- Component-specific styling
|
|
241
|
+
- References semantic tokens
|
|
242
|
+
- Inherited automatically when creating new themes
|
|
243
|
+
|
|
244
|
+
Example:
|
|
245
|
+
|
|
246
|
+
```css
|
|
247
|
+
--btn-primary-bg: linear-gradient(135deg, var(--semantic-primary), var(--semantic-secondary));
|
|
248
|
+
--btn-primary-text: var(--semantic-text-inverse);
|
|
249
|
+
--input-border: var(--semantic-border);
|
|
250
|
+
--modal-bg: var(--semantic-surface-elevated);
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### Using Tokens in Your Code
|
|
254
|
+
|
|
255
|
+
**DO ✅ Use semantic tokens:**
|
|
256
|
+
|
|
257
|
+
```tsx
|
|
258
|
+
// Tailwind arbitrary values
|
|
259
|
+
<div className="bg-[var(--semantic-surface)] text-[var(--semantic-text)]">
|
|
260
|
+
Content
|
|
261
|
+
</div>
|
|
262
|
+
|
|
263
|
+
// Custom CSS
|
|
264
|
+
.my-component {
|
|
265
|
+
background: var(--semantic-surface);
|
|
266
|
+
color: var(--semantic-text);
|
|
267
|
+
border: 1px solid var(--semantic-border);
|
|
268
|
+
}
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
**DON'T ❌ Hardcode OKLCH values:**
|
|
272
|
+
|
|
273
|
+
```tsx
|
|
274
|
+
// ❌ BAD
|
|
275
|
+
<div style={{ background: 'oklch(66.6% 0.159 303)' }}>Content</div>
|
|
276
|
+
|
|
277
|
+
// ❌ BAD
|
|
278
|
+
.my-component {
|
|
279
|
+
background: oklch(100% 0 0 / 0.08);
|
|
280
|
+
}
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### v2.0.0 Breaking Changes
|
|
284
|
+
|
|
285
|
+
**Removed CSS variables** (use semantic replacements):
|
|
286
|
+
|
|
287
|
+
| Removed (v1.x) | Replacement (v2.0+) |
|
|
288
|
+
| -------------------- | ------------------------ |
|
|
289
|
+
| `--metric-emerald-*` | `--metric-success-*` |
|
|
290
|
+
| `--metric-amber-*` | `--metric-warning-*` |
|
|
291
|
+
| `--metric-blue-*` | `--metric-default-*` |
|
|
292
|
+
| `--metric-red-*` | `--metric-destructive-*` |
|
|
293
|
+
|
|
294
|
+
**Migration:**
|
|
295
|
+
|
|
296
|
+
```css
|
|
297
|
+
/* ❌ v1.x (REMOVED) */
|
|
298
|
+
background: var(--metric-emerald-bg);
|
|
299
|
+
|
|
300
|
+
/* ✅ v2.0+ */
|
|
301
|
+
background: var(--metric-success-bg);
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
See [CSS Variables Migration Guide](migration/CSS_VARIABLES_MIGRATION_2.0.md) for automated
|
|
305
|
+
migration scripts.
|
|
306
|
+
|
|
307
|
+
### Benefits
|
|
308
|
+
|
|
309
|
+
- **15-minute theme creation** - Was 2-3 hours before v2.0.0
|
|
310
|
+
- **Zero duplication** - Single source of truth for colors
|
|
311
|
+
- **Type-safe theming** - Semantic names prevent confusion
|
|
312
|
+
- **Maintainability** - Update one variable, affects all components
|
|
313
|
+
|
|
314
|
+
### Documentation
|
|
315
|
+
|
|
316
|
+
- [TOKEN_ARCHITECTURE.md](TOKEN_ARCHITECTURE.md) - Complete 3-layer system guide
|
|
317
|
+
- [THEME_CREATION_GUIDE.md](THEME_CREATION_GUIDE.md) - Create themes in 15 minutes
|
|
318
|
+
- [CSS_VARIABLES_AUDIT.md](CSS_VARIABLES_AUDIT.md) - Full variable reference
|
|
319
|
+
|
|
320
|
+
## Theme Configuration
|
|
321
|
+
|
|
322
|
+
### Basic Theme Setup
|
|
323
|
+
|
|
324
|
+
Wrap your app with a theme class:
|
|
325
|
+
|
|
326
|
+
```tsx
|
|
327
|
+
// app.tsx or layout.tsx
|
|
328
|
+
export default function App() {
|
|
329
|
+
return (
|
|
330
|
+
<div className="theme-glass min-h-screen bg-gradient-to-br from-slate-900 via-purple-900 to-slate-900">
|
|
331
|
+
<YourApp />
|
|
332
|
+
</div>
|
|
333
|
+
);
|
|
334
|
+
}
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
### Dynamic Theme Switching
|
|
338
|
+
|
|
339
|
+
Use the built-in theme provider:
|
|
340
|
+
|
|
341
|
+
```tsx
|
|
342
|
+
// main.tsx or app.tsx
|
|
343
|
+
import { ThemeProvider } from '@/lib/theme-context';
|
|
344
|
+
|
|
345
|
+
function Main() {
|
|
346
|
+
return (
|
|
347
|
+
<ThemeProvider defaultTheme="glass">
|
|
348
|
+
<App />
|
|
349
|
+
</ThemeProvider>
|
|
350
|
+
);
|
|
351
|
+
}
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
Create a theme switcher component:
|
|
355
|
+
|
|
356
|
+
```tsx
|
|
357
|
+
// components/ThemeSwitcher.tsx
|
|
358
|
+
import { useTheme } from '@/lib/theme-context';
|
|
359
|
+
import { ButtonGlass } from '@/components/glass/ui/button-glass';
|
|
360
|
+
|
|
361
|
+
export function ThemeSwitcher() {
|
|
362
|
+
const { theme, setTheme } = useTheme();
|
|
363
|
+
|
|
364
|
+
return (
|
|
365
|
+
<div className="flex gap-2">
|
|
366
|
+
<ButtonGlass
|
|
367
|
+
variant={theme === 'glass' ? 'primary' : 'ghost'}
|
|
368
|
+
size="sm"
|
|
369
|
+
onClick={() => setTheme('glass')}
|
|
370
|
+
>
|
|
371
|
+
Glass
|
|
372
|
+
</ButtonGlass>
|
|
373
|
+
|
|
374
|
+
<ButtonGlass
|
|
375
|
+
variant={theme === 'light' ? 'primary' : 'ghost'}
|
|
376
|
+
size="sm"
|
|
377
|
+
onClick={() => setTheme('light')}
|
|
378
|
+
>
|
|
379
|
+
Light
|
|
380
|
+
</ButtonGlass>
|
|
381
|
+
|
|
382
|
+
<ButtonGlass
|
|
383
|
+
variant={theme === 'aurora' ? 'primary' : 'ghost'}
|
|
384
|
+
size="sm"
|
|
385
|
+
onClick={() => setTheme('aurora')}
|
|
386
|
+
>
|
|
387
|
+
Aurora
|
|
388
|
+
</ButtonGlass>
|
|
389
|
+
</div>
|
|
390
|
+
);
|
|
391
|
+
}
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
## First Component
|
|
395
|
+
|
|
396
|
+
### Simple Button
|
|
397
|
+
|
|
398
|
+
```tsx
|
|
399
|
+
import { ButtonGlass } from 'shadcn-glass-ui';
|
|
400
|
+
// or: import { ButtonGlass } from '@/components/glass/ui/button-glass';
|
|
401
|
+
|
|
402
|
+
export default function Demo() {
|
|
403
|
+
return (
|
|
404
|
+
<div className="theme-glass p-8">
|
|
405
|
+
<ButtonGlass variant="primary" size="md" onClick={() => alert('Clicked!')}>
|
|
406
|
+
Click Me
|
|
407
|
+
</ButtonGlass>
|
|
408
|
+
</div>
|
|
409
|
+
);
|
|
410
|
+
}
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
### Form with Input
|
|
414
|
+
|
|
415
|
+
```tsx
|
|
416
|
+
import { useState } from 'react';
|
|
417
|
+
import { InputGlass, ButtonGlass } from 'shadcn-glass-ui';
|
|
418
|
+
|
|
419
|
+
export default function LoginForm() {
|
|
420
|
+
const [email, setEmail] = useState('');
|
|
421
|
+
const [password, setPassword] = useState('');
|
|
422
|
+
|
|
423
|
+
const handleSubmit = (e: React.FormEvent) => {
|
|
424
|
+
e.preventDefault();
|
|
425
|
+
console.log('Login:', { email, password });
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
return (
|
|
429
|
+
<div className="theme-glass min-h-screen flex items-center justify-center p-8">
|
|
430
|
+
<form onSubmit={handleSubmit} className="space-y-4 w-full max-w-md">
|
|
431
|
+
<h1 className="text-2xl font-bold mb-6">Login</h1>
|
|
432
|
+
|
|
433
|
+
<InputGlass
|
|
434
|
+
label="Email"
|
|
435
|
+
type="email"
|
|
436
|
+
value={email}
|
|
437
|
+
onChange={(e) => setEmail(e.target.value)}
|
|
438
|
+
placeholder="you@example.com"
|
|
439
|
+
/>
|
|
440
|
+
|
|
441
|
+
<InputGlass
|
|
442
|
+
label="Password"
|
|
443
|
+
type="password"
|
|
444
|
+
value={password}
|
|
445
|
+
onChange={(e) => setPassword(e.target.value)}
|
|
446
|
+
placeholder="••••••••"
|
|
447
|
+
/>
|
|
448
|
+
|
|
449
|
+
<ButtonGlass type="submit" className="w-full">
|
|
450
|
+
Sign In
|
|
451
|
+
</ButtonGlass>
|
|
452
|
+
</form>
|
|
453
|
+
</div>
|
|
454
|
+
);
|
|
455
|
+
}
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
### Card with Content
|
|
459
|
+
|
|
460
|
+
```tsx
|
|
461
|
+
import { GlassCard, ButtonGlass, BadgeGlass } from 'shadcn-glass-ui';
|
|
462
|
+
|
|
463
|
+
export default function ProductCard() {
|
|
464
|
+
return (
|
|
465
|
+
<div className="theme-glass p-8">
|
|
466
|
+
<GlassCard variant="glass" intensity="medium" padding="default">
|
|
467
|
+
<div className="space-y-4">
|
|
468
|
+
<div className="flex items-center justify-between">
|
|
469
|
+
<h3 className="text-xl font-semibold">Glass UI Pro</h3>
|
|
470
|
+
<BadgeGlass variant="success">New</BadgeGlass>
|
|
471
|
+
</div>
|
|
472
|
+
|
|
473
|
+
<p className="text-sm opacity-80">
|
|
474
|
+
Premium glassmorphism components for modern applications
|
|
475
|
+
</p>
|
|
476
|
+
|
|
477
|
+
<div className="flex items-center justify-between pt-4">
|
|
478
|
+
<span className="text-2xl font-bold">$49</span>
|
|
479
|
+
<ButtonGlass variant="primary">Purchase</ButtonGlass>
|
|
480
|
+
</div>
|
|
481
|
+
</div>
|
|
482
|
+
</GlassCard>
|
|
483
|
+
</div>
|
|
484
|
+
);
|
|
485
|
+
}
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
## Common Patterns
|
|
489
|
+
|
|
490
|
+
### Modal Dialog
|
|
491
|
+
|
|
492
|
+
```tsx
|
|
493
|
+
import { useState } from 'react';
|
|
494
|
+
import { ModalGlass, ButtonGlass } from 'shadcn-glass-ui';
|
|
495
|
+
|
|
496
|
+
export default function ModalDemo() {
|
|
497
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
498
|
+
|
|
499
|
+
return (
|
|
500
|
+
<div className="theme-glass p-8">
|
|
501
|
+
<ButtonGlass onClick={() => setIsOpen(true)}>Open Modal</ButtonGlass>
|
|
502
|
+
|
|
503
|
+
<ModalGlass isOpen={isOpen} onClose={() => setIsOpen(false)} title="Confirm Action" size="md">
|
|
504
|
+
<p className="mb-6">Are you sure you want to proceed?</p>
|
|
505
|
+
|
|
506
|
+
<div className="flex gap-3 justify-end">
|
|
507
|
+
<ButtonGlass variant="ghost" onClick={() => setIsOpen(false)}>
|
|
508
|
+
Cancel
|
|
509
|
+
</ButtonGlass>
|
|
510
|
+
<ButtonGlass
|
|
511
|
+
onClick={() => {
|
|
512
|
+
console.log('Confirmed');
|
|
513
|
+
setIsOpen(false);
|
|
514
|
+
}}
|
|
515
|
+
>
|
|
516
|
+
Confirm
|
|
517
|
+
</ButtonGlass>
|
|
518
|
+
</div>
|
|
519
|
+
</ModalGlass>
|
|
520
|
+
</div>
|
|
521
|
+
);
|
|
522
|
+
}
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
### Settings Panel
|
|
526
|
+
|
|
527
|
+
```tsx
|
|
528
|
+
import { ToggleGlass, CheckboxGlass } from 'shadcn-glass-ui';
|
|
529
|
+
|
|
530
|
+
export default function SettingsPanel() {
|
|
531
|
+
const [settings, setSettings] = useState({
|
|
532
|
+
notifications: true,
|
|
533
|
+
darkMode: false,
|
|
534
|
+
autoSave: true,
|
|
535
|
+
emailUpdates: false,
|
|
536
|
+
});
|
|
537
|
+
|
|
538
|
+
return (
|
|
539
|
+
<div className="theme-glass p-8">
|
|
540
|
+
<div className="space-y-6">
|
|
541
|
+
<h2 className="text-xl font-semibold mb-4">Settings</h2>
|
|
542
|
+
|
|
543
|
+
<div className="space-y-4">
|
|
544
|
+
<ToggleGlass
|
|
545
|
+
checked={settings.notifications}
|
|
546
|
+
onCheckedChange={(checked) =>
|
|
547
|
+
setSettings((prev) => ({ ...prev, notifications: checked }))
|
|
548
|
+
}
|
|
549
|
+
label="Push Notifications"
|
|
550
|
+
/>
|
|
551
|
+
|
|
552
|
+
<ToggleGlass
|
|
553
|
+
checked={settings.darkMode}
|
|
554
|
+
onCheckedChange={(checked) => setSettings((prev) => ({ ...prev, darkMode: checked }))}
|
|
555
|
+
label="Dark Mode"
|
|
556
|
+
/>
|
|
557
|
+
|
|
558
|
+
<CheckboxGlass
|
|
559
|
+
id="auto-save"
|
|
560
|
+
checked={settings.autoSave}
|
|
561
|
+
onCheckedChange={(checked) => setSettings((prev) => ({ ...prev, autoSave: checked }))}
|
|
562
|
+
label="Auto Save"
|
|
563
|
+
/>
|
|
564
|
+
|
|
565
|
+
<CheckboxGlass
|
|
566
|
+
id="email-updates"
|
|
567
|
+
checked={settings.emailUpdates}
|
|
568
|
+
onCheckedChange={(checked) =>
|
|
569
|
+
setSettings((prev) => ({ ...prev, emailUpdates: checked }))
|
|
570
|
+
}
|
|
571
|
+
label="Email Updates"
|
|
572
|
+
/>
|
|
573
|
+
</div>
|
|
574
|
+
</div>
|
|
575
|
+
</div>
|
|
576
|
+
);
|
|
577
|
+
}
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
### Navigation with Tabs
|
|
581
|
+
|
|
582
|
+
```tsx
|
|
583
|
+
import { TabsGlass } from 'shadcn-glass-ui';
|
|
584
|
+
|
|
585
|
+
export default function Dashboard() {
|
|
586
|
+
return (
|
|
587
|
+
<div className="theme-glass p-8">
|
|
588
|
+
<TabsGlass defaultValue="overview">
|
|
589
|
+
<TabsGlass.List>
|
|
590
|
+
<TabsGlass.Trigger value="overview">Overview</TabsGlass.Trigger>
|
|
591
|
+
<TabsGlass.Trigger value="analytics">Analytics</TabsGlass.Trigger>
|
|
592
|
+
<TabsGlass.Trigger value="settings">Settings</TabsGlass.Trigger>
|
|
593
|
+
</TabsGlass.List>
|
|
594
|
+
|
|
595
|
+
<TabsGlass.Content value="overview">
|
|
596
|
+
<h3 className="text-lg font-semibold mb-4">Overview</h3>
|
|
597
|
+
<p>Dashboard overview content...</p>
|
|
598
|
+
</TabsGlass.Content>
|
|
599
|
+
|
|
600
|
+
<TabsGlass.Content value="analytics">
|
|
601
|
+
<h3 className="text-lg font-semibold mb-4">Analytics</h3>
|
|
602
|
+
<p>Analytics charts and data...</p>
|
|
603
|
+
</TabsGlass.Content>
|
|
604
|
+
|
|
605
|
+
<TabsGlass.Content value="settings">
|
|
606
|
+
<h3 className="text-lg font-semibold mb-4">Settings</h3>
|
|
607
|
+
<p>Settings configuration...</p>
|
|
608
|
+
</TabsGlass.Content>
|
|
609
|
+
</TabsGlass>
|
|
610
|
+
</div>
|
|
611
|
+
);
|
|
612
|
+
}
|
|
613
|
+
```
|
|
614
|
+
|
|
615
|
+
## Next Steps
|
|
616
|
+
|
|
617
|
+
### Explore More Components
|
|
618
|
+
|
|
619
|
+
- [ButtonGlass](../src/components/ButtonGlass.mdx) - All button variants
|
|
620
|
+
- [InputGlass](../src/components/InputGlass.mdx) - Form inputs
|
|
621
|
+
- [ModalGlass](../src/components/ModalGlass.mdx) - Dialogs
|
|
622
|
+
- [GlassCard](../src/components/GlassCard.mdx) - Card containers
|
|
623
|
+
- [Full Component List](../README.md#component-categories)
|
|
624
|
+
|
|
625
|
+
### Learn the Design System
|
|
626
|
+
|
|
627
|
+
Read [UI_DESIGN.md](design-system/UI_DESIGN.md) to understand:
|
|
628
|
+
|
|
629
|
+
- Design tokens and spacing
|
|
630
|
+
- Touch target requirements
|
|
631
|
+
- Accessibility guidelines
|
|
632
|
+
- Theme specifications
|
|
633
|
+
|
|
634
|
+
### Browse Examples
|
|
635
|
+
|
|
636
|
+
- [Storybook](https://yhooi2.github.io/shadcn-glass-ui-library/) - Live component demos
|
|
637
|
+
- [ComponentShowcase](../src/components/ComponentShowcase.tsx) - All components in one page
|
|
638
|
+
- [DesktopShowcase](../src/components/DesktopShowcase.tsx) - Full application example
|
|
639
|
+
|
|
640
|
+
### Customize
|
|
641
|
+
|
|
642
|
+
- Create custom variants with CVA
|
|
643
|
+
- Extend theme with custom colors
|
|
644
|
+
- Build composite components
|
|
645
|
+
- Add your own glass effects
|
|
646
|
+
|
|
647
|
+
### Get Help
|
|
648
|
+
|
|
649
|
+
- [GitHub Discussions](https://github.com/Yhooi2/shadcn-glass-ui-library/discussions)
|
|
650
|
+
- [Issues](https://github.com/Yhooi2/shadcn-glass-ui-library/issues)
|
|
651
|
+
- [Contributing Guide](../CONTRIBUTING.md)
|
|
652
|
+
|
|
653
|
+
---
|
|
654
|
+
|
|
655
|
+
**Happy building with glassmorphism!** ✨
|