create-huenei-template 0.2.3 → 0.2.4
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/dist/templates/frontend/angular-base/.cursor/skills/angular-component/SKILL.md +288 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-component/references/component-patterns.md +358 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-di/SKILL.md +387 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-di/references/di-patterns.md +519 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-directives/SKILL.md +437 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-directives/references/directive-patterns.md +570 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-forms/SKILL.md +434 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-forms/references/form-patterns.md +398 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-http/SKILL.md +366 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-http/references/http-patterns.md +448 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-routing/SKILL.md +395 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-routing/references/routing-patterns.md +472 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-signals/SKILL.md +302 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-signals/references/signal-patterns.md +404 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-ssr/SKILL.md +435 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-ssr/references/ssr-patterns.md +497 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-testing/SKILL.md +660 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-testing/references/testing-patterns.md +707 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-tooling/SKILL.md +352 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-tooling/references/tooling-patterns.md +448 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-accessibility/SKILL.md +780 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-components/SKILL.md +718 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-design-systems/SKILL.md +612 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-layouts/SKILL.md +594 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/SKILL.md +432 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/references/animation-patterns.md +427 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/SKILL.md +354 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/references/troubleshooting-guide.md +306 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/SKILL.md +578 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/references/react-patterns.md +353 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/SKILL.md +608 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/advanced-theme-patterns.md +215 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/custom-utilities-guide.md +281 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-mobile-first/SKILL.md +768 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/SKILL.md +374 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/references/bundle-optimization.md +244 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-plugins/SKILL.md +505 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/SKILL.md +601 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/references/advanced-responsive-patterns.md +485 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/web-design-guidelines/SKILL.md +39 -0
- package/dist/templates/frontend/angular-base/package.json +0 -1
- package/dist/templates/frontend/angular-base/pnpm-lock.yaml +8183 -0
- package/package.json +1 -1
- package/templates/frontend/angular-base/.cursor/skills/angular-component/SKILL.md +288 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-component/references/component-patterns.md +358 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-di/SKILL.md +387 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-di/references/di-patterns.md +519 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-directives/SKILL.md +437 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-directives/references/directive-patterns.md +570 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-forms/SKILL.md +434 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-forms/references/form-patterns.md +398 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-http/SKILL.md +366 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-http/references/http-patterns.md +448 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-routing/SKILL.md +395 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-routing/references/routing-patterns.md +472 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-signals/SKILL.md +302 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-signals/references/signal-patterns.md +404 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-ssr/SKILL.md +435 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-ssr/references/ssr-patterns.md +497 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-testing/SKILL.md +660 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-testing/references/testing-patterns.md +707 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-tooling/SKILL.md +352 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-tooling/references/tooling-patterns.md +448 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-accessibility/SKILL.md +780 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-components/SKILL.md +718 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-design-systems/SKILL.md +612 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-layouts/SKILL.md +594 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/SKILL.md +432 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/references/animation-patterns.md +427 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/SKILL.md +354 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/references/troubleshooting-guide.md +306 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/SKILL.md +578 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/references/react-patterns.md +353 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/SKILL.md +608 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/advanced-theme-patterns.md +215 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/custom-utilities-guide.md +281 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-mobile-first/SKILL.md +768 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/SKILL.md +374 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/references/bundle-optimization.md +244 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-plugins/SKILL.md +505 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/SKILL.md +601 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/references/advanced-responsive-patterns.md +485 -0
- package/templates/frontend/angular-base/.cursor/skills/web-design-guidelines/SKILL.md +39 -0
- package/templates/frontend/angular-base/package.json +0 -1
- package/templates/frontend/angular-base/pnpm-lock.yaml +8183 -0
- package/templates/frontend/angular-base/package-lock.json +0 -13321
package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/SKILL.md
ADDED
|
@@ -0,0 +1,608 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tailwindcss-fundamentals-v4
|
|
3
|
+
description: Tailwind CSS v4 fundamentals covering installation, CSS-first configuration, design systems, and 2025/2026 best practices
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Tailwind CSS v4 Fundamentals (2025/2026)
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Tailwind CSS v4.0 was released January 22, 2025, featuring a complete rewrite with a Rust-based engine, CSS-first configuration, and significant performance improvements.
|
|
11
|
+
|
|
12
|
+
### Key Changes from v3
|
|
13
|
+
|
|
14
|
+
| Feature | v3 | v4 |
|
|
15
|
+
|---------|----|----|
|
|
16
|
+
| Configuration | JavaScript (tailwind.config.js) | CSS-first (@theme directive) |
|
|
17
|
+
| Engine | Node.js | Rust (10x faster) |
|
|
18
|
+
| Color format | hex/rgb | OKLCH (perceptually uniform) |
|
|
19
|
+
| Plugins | JS files | @plugin directive |
|
|
20
|
+
| Custom utilities | JS config | @utility directive |
|
|
21
|
+
| PostCSS imports | postcss-import | Built-in |
|
|
22
|
+
| Autoprefixer | Required | Built-in |
|
|
23
|
+
| CSS nesting | postcss-nested | Built-in |
|
|
24
|
+
| Content detection | Explicit config | Automatic |
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
### Vite Projects (Recommended)
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install -D tailwindcss @tailwindcss/vite
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```javascript
|
|
35
|
+
// vite.config.js
|
|
36
|
+
import tailwindcss from '@tailwindcss/vite'
|
|
37
|
+
import { defineConfig } from 'vite'
|
|
38
|
+
|
|
39
|
+
export default defineConfig({
|
|
40
|
+
plugins: [tailwindcss()]
|
|
41
|
+
})
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### PostCSS Projects
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm install -D tailwindcss @tailwindcss/postcss
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
```javascript
|
|
51
|
+
// postcss.config.mjs
|
|
52
|
+
export default {
|
|
53
|
+
plugins: {
|
|
54
|
+
'@tailwindcss/postcss': {}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### CSS Entry Point
|
|
60
|
+
|
|
61
|
+
```css
|
|
62
|
+
/* app.css - The only required CSS file */
|
|
63
|
+
@import "tailwindcss";
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## CSS-First Configuration
|
|
67
|
+
|
|
68
|
+
### The @theme Directive
|
|
69
|
+
|
|
70
|
+
Replace tailwind.config.js with CSS-based configuration:
|
|
71
|
+
|
|
72
|
+
```css
|
|
73
|
+
@import "tailwindcss";
|
|
74
|
+
|
|
75
|
+
@theme {
|
|
76
|
+
/* Colors using modern oklch */
|
|
77
|
+
--color-primary: oklch(0.6 0.2 250);
|
|
78
|
+
--color-secondary: oklch(0.7 0.15 180);
|
|
79
|
+
--color-accent: oklch(0.8 0.2 30);
|
|
80
|
+
|
|
81
|
+
/* Typography */
|
|
82
|
+
--font-display: "Satoshi", sans-serif;
|
|
83
|
+
--font-body: "Inter", sans-serif;
|
|
84
|
+
|
|
85
|
+
/* Custom spacing */
|
|
86
|
+
--spacing-xs: 0.25rem;
|
|
87
|
+
--spacing-sm: 0.5rem;
|
|
88
|
+
--spacing-md: 1rem;
|
|
89
|
+
--spacing-lg: 2rem;
|
|
90
|
+
--spacing-xl: 4rem;
|
|
91
|
+
|
|
92
|
+
/* Custom breakpoints */
|
|
93
|
+
--breakpoint-xs: 475px;
|
|
94
|
+
--breakpoint-3xl: 1920px;
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Theme Variables Reference
|
|
99
|
+
|
|
100
|
+
| Category | Variable Pattern | Example |
|
|
101
|
+
|----------|-----------------|---------|
|
|
102
|
+
| Colors | `--color-*` | `--color-brand-500` |
|
|
103
|
+
| Fonts | `--font-*` | `--font-heading` |
|
|
104
|
+
| Spacing | `--spacing-*` | `--spacing-4` |
|
|
105
|
+
| Breakpoints | `--breakpoint-*` | `--breakpoint-3xl` |
|
|
106
|
+
| Radius | `--radius-*` | `--radius-lg` |
|
|
107
|
+
| Shadows | `--shadow-*` | `--shadow-xl` |
|
|
108
|
+
| Animations | `--animate-*` | `--animate-fade-in` |
|
|
109
|
+
| Easing | `--ease-*` | `--ease-bounce` |
|
|
110
|
+
|
|
111
|
+
### Disabling Defaults
|
|
112
|
+
|
|
113
|
+
```css
|
|
114
|
+
@theme {
|
|
115
|
+
/* Start fresh - disable all default theme values */
|
|
116
|
+
--*: initial;
|
|
117
|
+
|
|
118
|
+
/* Define only what you need */
|
|
119
|
+
--spacing: 4px;
|
|
120
|
+
--font-body: Inter, sans-serif;
|
|
121
|
+
--color-primary: oklch(0.72 0.11 221.19);
|
|
122
|
+
--color-secondary: oklch(0.74 0.17 40.24);
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Custom Utilities
|
|
127
|
+
|
|
128
|
+
### Static Utilities
|
|
129
|
+
|
|
130
|
+
```css
|
|
131
|
+
/* Define custom utility in CSS */
|
|
132
|
+
@utility content-auto {
|
|
133
|
+
content-visibility: auto;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
@utility text-balance {
|
|
137
|
+
text-wrap: balance;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
@utility scrollbar-hide {
|
|
141
|
+
-ms-overflow-style: none;
|
|
142
|
+
scrollbar-width: none;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
@utility scrollbar-hide::-webkit-scrollbar {
|
|
146
|
+
display: none;
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Usage:
|
|
151
|
+
```html
|
|
152
|
+
<div class="content-auto scrollbar-hide">
|
|
153
|
+
<h1 class="text-balance">Long headline that should balance nicely</h1>
|
|
154
|
+
</div>
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Functional Utilities
|
|
158
|
+
|
|
159
|
+
```css
|
|
160
|
+
/* Utility that accepts values */
|
|
161
|
+
@utility tab-* {
|
|
162
|
+
tab-size: --value(integer);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
@utility text-shadow-* {
|
|
166
|
+
text-shadow: 0 0 --value([length]) currentColor;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/* With theme reference */
|
|
170
|
+
@utility gap-safe-* {
|
|
171
|
+
gap: max(--value(--spacing-*), env(safe-area-inset-bottom));
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Usage:
|
|
176
|
+
```html
|
|
177
|
+
<pre class="tab-4">Code with 4-space tabs</pre>
|
|
178
|
+
<h1 class="text-shadow-[2px]">Glowing text</h1>
|
|
179
|
+
<div class="gap-safe-4">Safe area aware gap</div>
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Custom Variants
|
|
183
|
+
|
|
184
|
+
### The @custom-variant Directive
|
|
185
|
+
|
|
186
|
+
```css
|
|
187
|
+
/* Dark mode with selector */
|
|
188
|
+
@custom-variant dark (&:where(.dark, .dark *));
|
|
189
|
+
|
|
190
|
+
/* Custom state variants */
|
|
191
|
+
@custom-variant hocus (&:hover, &:focus);
|
|
192
|
+
@custom-variant group-hocus (:merge(.group):hover &, :merge(.group):focus &);
|
|
193
|
+
|
|
194
|
+
/* Data attribute variants */
|
|
195
|
+
@custom-variant data-loading (&[data-loading="true"]);
|
|
196
|
+
@custom-variant data-active (&[data-state="active"]);
|
|
197
|
+
|
|
198
|
+
/* Child selectors */
|
|
199
|
+
@custom-variant children (& > *);
|
|
200
|
+
@custom-variant not-first (& > *:not(:first-child));
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Usage:
|
|
204
|
+
```html
|
|
205
|
+
<button class="hocus:bg-blue-600">Hover or focus</button>
|
|
206
|
+
<div class="data-loading:opacity-50" data-loading="true">Loading...</div>
|
|
207
|
+
<ul class="children:border-b not-first:pt-2">
|
|
208
|
+
<li>Item 1</li>
|
|
209
|
+
<li>Item 2</li>
|
|
210
|
+
</ul>
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## Loading Plugins
|
|
214
|
+
|
|
215
|
+
### The @plugin Directive
|
|
216
|
+
|
|
217
|
+
```css
|
|
218
|
+
@import "tailwindcss";
|
|
219
|
+
|
|
220
|
+
/* Load official plugins */
|
|
221
|
+
@plugin "@tailwindcss/typography";
|
|
222
|
+
@plugin "@tailwindcss/forms";
|
|
223
|
+
@plugin "@tailwindcss/container-queries";
|
|
224
|
+
|
|
225
|
+
/* Load local plugin */
|
|
226
|
+
@plugin "./my-plugin.js";
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Plugin with Options
|
|
230
|
+
|
|
231
|
+
```css
|
|
232
|
+
@plugin "@tailwindcss/typography" {
|
|
233
|
+
className: wysiwyg;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
@plugin "@tailwindcss/forms" {
|
|
237
|
+
strategy: class;
|
|
238
|
+
}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Using Prefixes
|
|
242
|
+
|
|
243
|
+
```css
|
|
244
|
+
@import "tailwindcss" prefix(tw);
|
|
245
|
+
|
|
246
|
+
@theme {
|
|
247
|
+
/* Define without prefix */
|
|
248
|
+
--font-display: "Satoshi", sans-serif;
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
```html
|
|
253
|
+
<!-- Use with prefix -->
|
|
254
|
+
<div class="tw:flex tw:bg-red-500 tw:hover:bg-red-600">
|
|
255
|
+
Content
|
|
256
|
+
</div>
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Generated CSS variables include prefix:
|
|
260
|
+
```css
|
|
261
|
+
:root {
|
|
262
|
+
--tw-font-display: "Satoshi", sans-serif;
|
|
263
|
+
}
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
## CSS Variables in Code
|
|
267
|
+
|
|
268
|
+
### Replace theme() with var()
|
|
269
|
+
|
|
270
|
+
```css
|
|
271
|
+
/* v3 approach (deprecated) */
|
|
272
|
+
.old-way {
|
|
273
|
+
background-color: theme(colors.red.500);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/* v4 approach */
|
|
277
|
+
.new-way {
|
|
278
|
+
background-color: var(--color-red-500);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/* In media queries, use CSS variable names */
|
|
282
|
+
@media (width >= theme(--breakpoint-xl)) {
|
|
283
|
+
/* styles */
|
|
284
|
+
}
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
## Core Utility Categories
|
|
288
|
+
|
|
289
|
+
### Layout
|
|
290
|
+
|
|
291
|
+
```html
|
|
292
|
+
<!-- Flexbox -->
|
|
293
|
+
<div class="flex flex-col md:flex-row items-center justify-between gap-4">
|
|
294
|
+
|
|
295
|
+
<!-- Grid -->
|
|
296
|
+
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
|
297
|
+
|
|
298
|
+
<!-- Container -->
|
|
299
|
+
<div class="container mx-auto px-4">
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
### Spacing
|
|
303
|
+
|
|
304
|
+
```html
|
|
305
|
+
<!-- Padding -->
|
|
306
|
+
<div class="p-4 px-6 py-2">
|
|
307
|
+
|
|
308
|
+
<!-- Margin -->
|
|
309
|
+
<div class="m-4 mx-auto my-8">
|
|
310
|
+
|
|
311
|
+
<!-- Gap -->
|
|
312
|
+
<div class="gap-4 gap-x-6 gap-y-2">
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### Typography
|
|
316
|
+
|
|
317
|
+
```html
|
|
318
|
+
<!-- Font size -->
|
|
319
|
+
<p class="text-sm md:text-base lg:text-lg">
|
|
320
|
+
|
|
321
|
+
<!-- Font weight -->
|
|
322
|
+
<h1 class="font-bold">
|
|
323
|
+
|
|
324
|
+
<!-- Text color -->
|
|
325
|
+
<p class="text-gray-600 dark:text-gray-300">
|
|
326
|
+
|
|
327
|
+
<!-- Line height -->
|
|
328
|
+
<p class="leading-relaxed">
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### Colors
|
|
332
|
+
|
|
333
|
+
```html
|
|
334
|
+
<!-- Background -->
|
|
335
|
+
<div class="bg-white dark:bg-gray-900">
|
|
336
|
+
|
|
337
|
+
<!-- Text -->
|
|
338
|
+
<p class="text-blue-600">
|
|
339
|
+
|
|
340
|
+
<!-- Border -->
|
|
341
|
+
<div class="border border-gray-200">
|
|
342
|
+
|
|
343
|
+
<!-- Ring -->
|
|
344
|
+
<button class="focus:ring-2 focus:ring-blue-500">
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
### Sizing
|
|
348
|
+
|
|
349
|
+
```html
|
|
350
|
+
<!-- Width -->
|
|
351
|
+
<div class="w-full md:w-1/2 lg:w-1/3">
|
|
352
|
+
|
|
353
|
+
<!-- Height -->
|
|
354
|
+
<div class="h-screen min-h-[500px]">
|
|
355
|
+
|
|
356
|
+
<!-- Max width -->
|
|
357
|
+
<div class="max-w-xl mx-auto">
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
## Arbitrary Values
|
|
361
|
+
|
|
362
|
+
```html
|
|
363
|
+
<!-- Use any CSS value -->
|
|
364
|
+
<div class="top-[117px] left-[calc(50%-4rem)]">
|
|
365
|
+
|
|
366
|
+
<!-- With CSS variables -->
|
|
367
|
+
<div class="bg-[var(--my-color)]">
|
|
368
|
+
|
|
369
|
+
<!-- Complex values -->
|
|
370
|
+
<div class="grid-cols-[1fr_500px_2fr]">
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
## Important Modifier
|
|
374
|
+
|
|
375
|
+
```html
|
|
376
|
+
<!-- Force important -->
|
|
377
|
+
<div class="!mt-0">
|
|
378
|
+
|
|
379
|
+
<!-- With variants -->
|
|
380
|
+
<div class="hover:!bg-red-500">
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
## Built-in Features (No Config Needed)
|
|
384
|
+
|
|
385
|
+
| Feature | v3 Requirement | v4 |
|
|
386
|
+
|---------|---------------|-----|
|
|
387
|
+
| @import handling | postcss-import | Built-in |
|
|
388
|
+
| Vendor prefixing | autoprefixer | Built-in |
|
|
389
|
+
| CSS nesting | postcss-nested | Built-in |
|
|
390
|
+
| Content detection | content config | Automatic |
|
|
391
|
+
|
|
392
|
+
## Layers
|
|
393
|
+
|
|
394
|
+
```css
|
|
395
|
+
/* Use native CSS layers */
|
|
396
|
+
@layer base {
|
|
397
|
+
h1 {
|
|
398
|
+
@apply text-2xl font-bold;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
@layer components {
|
|
403
|
+
.btn {
|
|
404
|
+
@apply px-4 py-2 rounded font-medium;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
@layer utilities {
|
|
409
|
+
/* Custom utilities via @utility directive instead */
|
|
410
|
+
}
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
## Best Practices (2025/2026)
|
|
414
|
+
|
|
415
|
+
### 1. Use OKLCH Colors for Design Systems
|
|
416
|
+
|
|
417
|
+
OKLCH provides perceptually uniform colors, better gradients, and wide gamut support:
|
|
418
|
+
|
|
419
|
+
```css
|
|
420
|
+
@theme {
|
|
421
|
+
/* OKLCH format: oklch(lightness chroma hue) */
|
|
422
|
+
/* Lightness: 0-1, Chroma: 0-0.4, Hue: 0-360 */
|
|
423
|
+
|
|
424
|
+
/* Primary palette - adjust L for shades */
|
|
425
|
+
--color-primary-50: oklch(0.97 0.02 250);
|
|
426
|
+
--color-primary-100: oklch(0.93 0.04 250);
|
|
427
|
+
--color-primary-500: oklch(0.55 0.2 250); /* Base */
|
|
428
|
+
--color-primary-600: oklch(0.48 0.2 250);
|
|
429
|
+
--color-primary-900: oklch(0.27 0.12 250);
|
|
430
|
+
|
|
431
|
+
/* Semantic colors */
|
|
432
|
+
--color-success: oklch(0.6 0.15 145);
|
|
433
|
+
--color-warning: oklch(0.75 0.15 65);
|
|
434
|
+
--color-error: oklch(0.55 0.2 25);
|
|
435
|
+
}
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
### 2. Implement Fluid Typography
|
|
439
|
+
|
|
440
|
+
Smooth scaling without breakpoint jumps:
|
|
441
|
+
|
|
442
|
+
```css
|
|
443
|
+
@theme {
|
|
444
|
+
/* Fluid type scale using clamp() */
|
|
445
|
+
/* clamp(min, preferred, max) */
|
|
446
|
+
--text-fluid-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
|
|
447
|
+
--text-fluid-sm: clamp(0.875rem, 0.8rem + 0.375vw, 1rem);
|
|
448
|
+
--text-fluid-base: clamp(1rem, 0.9rem + 0.5vw, 1.125rem);
|
|
449
|
+
--text-fluid-lg: clamp(1.125rem, 1rem + 0.625vw, 1.25rem);
|
|
450
|
+
--text-fluid-xl: clamp(1.25rem, 1rem + 1.25vw, 1.5rem);
|
|
451
|
+
--text-fluid-2xl: clamp(1.5rem, 1.1rem + 2vw, 2rem);
|
|
452
|
+
--text-fluid-3xl: clamp(1.875rem, 1.2rem + 3.375vw, 2.5rem);
|
|
453
|
+
--text-fluid-4xl: clamp(2.25rem, 1rem + 6.25vw, 3.5rem);
|
|
454
|
+
}
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
**Important**: Always combine `vw` with `rem` for accessibility (respects zoom).
|
|
458
|
+
|
|
459
|
+
### 3. Fluid Spacing System
|
|
460
|
+
|
|
461
|
+
```css
|
|
462
|
+
@theme {
|
|
463
|
+
/* Fluid spacing that scales with viewport */
|
|
464
|
+
--spacing-fluid-sm: clamp(0.5rem, 0.4rem + 0.5vw, 1rem);
|
|
465
|
+
--spacing-fluid-md: clamp(1rem, 0.75rem + 1.25vw, 2rem);
|
|
466
|
+
--spacing-fluid-lg: clamp(2rem, 1rem + 3vw, 4rem);
|
|
467
|
+
--spacing-fluid-section: clamp(4rem, 2rem + 8vw, 8rem);
|
|
468
|
+
}
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
### 4. Organize Theme by Category
|
|
472
|
+
|
|
473
|
+
```css
|
|
474
|
+
@theme {
|
|
475
|
+
/* === Colors === */
|
|
476
|
+
--color-primary: oklch(0.6 0.2 250);
|
|
477
|
+
--color-secondary: oklch(0.7 0.15 180);
|
|
478
|
+
--color-success: oklch(0.6 0.15 145);
|
|
479
|
+
--color-error: oklch(0.55 0.2 25);
|
|
480
|
+
|
|
481
|
+
/* === Typography === */
|
|
482
|
+
--font-sans: 'Inter Variable', system-ui, sans-serif;
|
|
483
|
+
--font-mono: 'JetBrains Mono', ui-monospace, monospace;
|
|
484
|
+
|
|
485
|
+
/* === Fluid Typography === */
|
|
486
|
+
--text-fluid-base: clamp(1rem, 0.9rem + 0.5vw, 1.25rem);
|
|
487
|
+
--text-fluid-lg: clamp(1.25rem, 1rem + 1.25vw, 2rem);
|
|
488
|
+
|
|
489
|
+
/* === Spacing === */
|
|
490
|
+
--spacing-page: 2rem;
|
|
491
|
+
--spacing-fluid-section: clamp(4rem, 2rem + 8vw, 8rem);
|
|
492
|
+
|
|
493
|
+
/* === Border Radius === */
|
|
494
|
+
--radius-sm: 0.25rem;
|
|
495
|
+
--radius-md: 0.5rem;
|
|
496
|
+
--radius-lg: 0.75rem;
|
|
497
|
+
|
|
498
|
+
/* === Shadows === */
|
|
499
|
+
--shadow-sm: 0 1px 2px oklch(0 0 0 / 0.05);
|
|
500
|
+
--shadow-md: 0 4px 6px oklch(0 0 0 / 0.07);
|
|
501
|
+
|
|
502
|
+
/* === Easing === */
|
|
503
|
+
--ease-fluid: cubic-bezier(0.3, 0, 0, 1);
|
|
504
|
+
--ease-snappy: cubic-bezier(0.2, 0, 0, 1);
|
|
505
|
+
}
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
### 5. Keep @utility Definitions Simple
|
|
509
|
+
|
|
510
|
+
```css
|
|
511
|
+
/* Good - single purpose utilities */
|
|
512
|
+
@utility truncate-2 {
|
|
513
|
+
display: -webkit-box;
|
|
514
|
+
-webkit-line-clamp: 2;
|
|
515
|
+
-webkit-box-orient: vertical;
|
|
516
|
+
overflow: hidden;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
@utility text-balance {
|
|
520
|
+
text-wrap: balance;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
@utility content-auto {
|
|
524
|
+
content-visibility: auto;
|
|
525
|
+
contain-intrinsic-size: auto 500px;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
/* Safe area utilities for notched devices */
|
|
529
|
+
@utility safe-area-pb {
|
|
530
|
+
padding-bottom: env(safe-area-inset-bottom);
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
@utility safe-area-pt {
|
|
534
|
+
padding-top: env(safe-area-inset-top);
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
/* Avoid - too complex, use components instead */
|
|
538
|
+
@utility card-fancy {
|
|
539
|
+
/* Too many properties - use @layer components */
|
|
540
|
+
}
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
### 6. Mobile-First Class Ordering
|
|
544
|
+
|
|
545
|
+
Always structure responsive classes progressively:
|
|
546
|
+
|
|
547
|
+
```html
|
|
548
|
+
<!-- Base (mobile) -> sm -> md -> lg -> xl -> 2xl -->
|
|
549
|
+
<div class="
|
|
550
|
+
text-sm md:text-base lg:text-lg
|
|
551
|
+
p-4 md:p-6 lg:p-8
|
|
552
|
+
grid-cols-1 md:grid-cols-2 lg:grid-cols-3
|
|
553
|
+
">
|
|
554
|
+
Content
|
|
555
|
+
</div>
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
### 7. Accessible Interactive Elements
|
|
559
|
+
|
|
560
|
+
```html
|
|
561
|
+
<!-- Touch-friendly button (44px minimum - WCAG 2.2) -->
|
|
562
|
+
<button class="
|
|
563
|
+
min-h-11 min-w-11 px-4 py-2.5
|
|
564
|
+
bg-primary-600 hover:bg-primary-700 text-white
|
|
565
|
+
rounded-lg font-medium
|
|
566
|
+
focus:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2
|
|
567
|
+
transition-colors motion-reduce:transition-none
|
|
568
|
+
">
|
|
569
|
+
Button Text
|
|
570
|
+
</button>
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
## Common Migration Issues
|
|
574
|
+
|
|
575
|
+
### Border Color Default
|
|
576
|
+
|
|
577
|
+
```css
|
|
578
|
+
/* v3: border used gray-200 by default */
|
|
579
|
+
/* v4: border uses currentColor */
|
|
580
|
+
|
|
581
|
+
/* Fix: explicitly set color */
|
|
582
|
+
@theme {
|
|
583
|
+
--default-border-color: var(--color-gray-200);
|
|
584
|
+
}
|
|
585
|
+
```
|
|
586
|
+
|
|
587
|
+
### Ring Default
|
|
588
|
+
|
|
589
|
+
```css
|
|
590
|
+
/* v3: ring was 3px blue-500 */
|
|
591
|
+
/* v4: ring is 1px currentColor */
|
|
592
|
+
|
|
593
|
+
/* Fix: restore v3 behavior */
|
|
594
|
+
@theme {
|
|
595
|
+
--default-ring-width: 3px;
|
|
596
|
+
--default-ring-color: var(--color-blue-500);
|
|
597
|
+
}
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
### Button Cursor
|
|
601
|
+
|
|
602
|
+
```css
|
|
603
|
+
/* v4: buttons use cursor: default */
|
|
604
|
+
/* Fix: add pointer globally if needed */
|
|
605
|
+
button {
|
|
606
|
+
cursor: pointer;
|
|
607
|
+
}
|
|
608
|
+
```
|