tribunal-kit 2.4.6 โ 3.1.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/.agent/ARCHITECTURE.md +99 -99
- package/.agent/GEMINI.md +52 -52
- package/.agent/agents/accessibility-reviewer.md +139 -86
- package/.agent/agents/ai-code-reviewer.md +160 -90
- package/.agent/agents/backend-specialist.md +164 -127
- package/.agent/agents/code-archaeologist.md +115 -73
- package/.agent/agents/database-architect.md +130 -110
- package/.agent/agents/debugger.md +137 -97
- package/.agent/agents/dependency-reviewer.md +78 -30
- package/.agent/agents/devops-engineer.md +161 -118
- package/.agent/agents/documentation-writer.md +151 -87
- package/.agent/agents/explorer-agent.md +117 -99
- package/.agent/agents/frontend-reviewer.md +127 -47
- package/.agent/agents/frontend-specialist.md +169 -109
- package/.agent/agents/game-developer.md +28 -164
- package/.agent/agents/logic-reviewer.md +87 -49
- package/.agent/agents/mobile-developer.md +151 -103
- package/.agent/agents/mobile-reviewer.md +133 -50
- package/.agent/agents/orchestrator.md +121 -110
- package/.agent/agents/penetration-tester.md +103 -77
- package/.agent/agents/performance-optimizer.md +136 -92
- package/.agent/agents/performance-reviewer.md +139 -69
- package/.agent/agents/product-manager.md +104 -70
- package/.agent/agents/product-owner.md +6 -25
- package/.agent/agents/project-planner.md +95 -95
- package/.agent/agents/qa-automation-engineer.md +174 -87
- package/.agent/agents/security-auditor.md +133 -129
- package/.agent/agents/seo-specialist.md +160 -99
- package/.agent/agents/sql-reviewer.md +132 -44
- package/.agent/agents/supervisor-agent.md +137 -109
- package/.agent/agents/swarm-worker-contracts.md +17 -17
- package/.agent/agents/swarm-worker-registry.md +46 -46
- package/.agent/agents/test-coverage-reviewer.md +132 -53
- package/.agent/agents/test-engineer.md +0 -21
- package/.agent/agents/type-safety-reviewer.md +143 -33
- package/.agent/patterns/generator.md +9 -9
- package/.agent/patterns/inversion.md +12 -12
- package/.agent/patterns/pipeline.md +9 -9
- package/.agent/patterns/reviewer.md +13 -13
- package/.agent/patterns/tool-wrapper.md +9 -9
- package/.agent/rules/GEMINI.md +63 -63
- package/.agent/scripts/__pycache__/auto_preview.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/bundle_analyzer.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/checklist.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/dependency_analyzer.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/security_scan.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/session_manager.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/skill_integrator.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/swarm_dispatcher.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/test_runner.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/verify_all.cpython-311.pyc +0 -0
- package/.agent/scripts/compress_skills.py +167 -0
- package/.agent/scripts/consolidate_skills.py +173 -0
- package/.agent/scripts/deep_compress.py +202 -0
- package/.agent/scripts/minify_context.py +80 -0
- package/.agent/scripts/security_scan.py +1 -1
- package/.agent/scripts/strip_tribunal.py +41 -0
- package/.agent/skills/agent-organizer/SKILL.md +60 -100
- package/.agent/skills/agentic-patterns/SKILL.md +0 -70
- package/.agent/skills/ai-prompt-injection-defense/SKILL.md +108 -53
- package/.agent/skills/api-patterns/SKILL.md +197 -257
- package/.agent/skills/api-security-auditor/SKILL.md +125 -57
- package/.agent/skills/app-builder/SKILL.md +326 -50
- package/.agent/skills/app-builder/templates/SKILL.md +13 -15
- package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +16 -16
- package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +22 -22
- package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +18 -18
- package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +20 -20
- package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +17 -17
- package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +18 -18
- package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +21 -21
- package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +19 -19
- package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +26 -26
- package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +26 -26
- package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +19 -19
- package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +18 -18
- package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +20 -20
- package/.agent/skills/appflow-wireframe/SKILL.md +71 -98
- package/.agent/skills/architecture/SKILL.md +161 -200
- package/.agent/skills/authentication-best-practices/SKILL.md +121 -54
- package/.agent/skills/bash-linux/SKILL.md +71 -166
- package/.agent/skills/behavioral-modes/SKILL.md +8 -69
- package/.agent/skills/brainstorming/SKILL.md +345 -127
- package/.agent/skills/building-native-ui/SKILL.md +125 -57
- package/.agent/skills/clean-code/SKILL.md +266 -149
- package/.agent/skills/code-review-checklist/SKILL.md +0 -62
- package/.agent/skills/config-validator/SKILL.md +73 -131
- package/.agent/skills/csharp-developer/SKILL.md +434 -73
- package/.agent/skills/database-design/SKILL.md +190 -275
- package/.agent/skills/deployment-procedures/SKILL.md +81 -158
- package/.agent/skills/devops-engineer/SKILL.md +255 -94
- package/.agent/skills/devops-incident-responder/SKILL.md +50 -69
- package/.agent/skills/doc.md +5 -5
- package/.agent/skills/documentation-templates/SKILL.md +19 -63
- package/.agent/skills/edge-computing/SKILL.md +75 -165
- package/.agent/skills/extract-design-system/SKILL.md +84 -58
- package/.agent/skills/framer-motion-expert/SKILL.md +195 -0
- package/.agent/skills/frontend-design/SKILL.md +151 -499
- package/.agent/skills/game-design-expert/SKILL.md +71 -0
- package/.agent/skills/game-engineering-expert/SKILL.md +88 -0
- package/.agent/skills/geo-fundamentals/SKILL.md +52 -178
- package/.agent/skills/github-operations/SKILL.md +197 -272
- package/.agent/skills/gsap-expert/SKILL.md +194 -0
- package/.agent/skills/i18n-localization/SKILL.md +60 -172
- package/.agent/skills/intelligent-routing/SKILL.md +123 -103
- package/.agent/skills/lint-and-validate/SKILL.md +8 -52
- package/.agent/skills/llm-engineering/SKILL.md +281 -195
- package/.agent/skills/local-first/SKILL.md +76 -159
- package/.agent/skills/mcp-builder/SKILL.md +48 -188
- package/.agent/skills/mobile-design/SKILL.md +213 -219
- package/.agent/skills/motion-engineering/SKILL.md +184 -0
- package/.agent/skills/nextjs-react-expert/SKILL.md +184 -203
- package/.agent/skills/nodejs-best-practices/SKILL.md +403 -185
- package/.agent/skills/observability/SKILL.md +211 -203
- package/.agent/skills/parallel-agents/SKILL.md +53 -146
- package/.agent/skills/performance-profiling/SKILL.md +171 -151
- package/.agent/skills/plan-writing/SKILL.md +49 -153
- package/.agent/skills/platform-engineer/SKILL.md +57 -103
- package/.agent/skills/playwright-best-practices/SKILL.md +110 -63
- package/.agent/skills/powershell-windows/SKILL.md +61 -179
- package/.agent/skills/python-patterns/SKILL.md +7 -35
- package/.agent/skills/python-pro/SKILL.md +273 -114
- package/.agent/skills/react-specialist/SKILL.md +227 -108
- package/.agent/skills/readme-builder/SKILL.md +15 -85
- package/.agent/skills/realtime-patterns/SKILL.md +216 -243
- package/.agent/skills/red-team-tactics/SKILL.md +10 -51
- package/.agent/skills/rust-pro/SKILL.md +525 -142
- package/.agent/skills/seo-fundamentals/SKILL.md +92 -153
- package/.agent/skills/server-management/SKILL.md +110 -166
- package/.agent/skills/shadcn-ui-expert/SKILL.md +154 -55
- package/.agent/skills/skill-creator/SKILL.md +18 -58
- package/.agent/skills/sql-pro/SKILL.md +543 -68
- package/.agent/skills/supabase-postgres-best-practices/SKILL.md +28 -68
- package/.agent/skills/swiftui-expert/SKILL.md +124 -57
- package/.agent/skills/systematic-debugging/SKILL.md +49 -151
- package/.agent/skills/tailwind-patterns/SKILL.md +433 -149
- package/.agent/skills/tdd-workflow/SKILL.md +63 -169
- package/.agent/skills/test-result-analyzer/SKILL.md +33 -73
- package/.agent/skills/testing-patterns/SKILL.md +437 -130
- package/.agent/skills/trend-researcher/SKILL.md +30 -71
- package/.agent/skills/ui-ux-pro-max/SKILL.md +0 -41
- package/.agent/skills/ui-ux-researcher/SKILL.md +51 -91
- package/.agent/skills/vue-expert/SKILL.md +225 -119
- package/.agent/skills/vulnerability-scanner/SKILL.md +264 -226
- package/.agent/skills/web-accessibility-auditor/SKILL.md +141 -58
- package/.agent/skills/web-design-guidelines/SKILL.md +17 -61
- package/.agent/skills/webapp-testing/SKILL.md +71 -196
- package/.agent/skills/whimsy-injector/SKILL.md +58 -132
- package/.agent/skills/workflow-optimizer/SKILL.md +28 -68
- package/.agent/workflows/api-tester.md +96 -224
- package/.agent/workflows/audit.md +81 -122
- package/.agent/workflows/brainstorm.md +69 -105
- package/.agent/workflows/changelog.md +65 -97
- package/.agent/workflows/create.md +73 -88
- package/.agent/workflows/debug.md +80 -111
- package/.agent/workflows/deploy.md +119 -92
- package/.agent/workflows/enhance.md +80 -91
- package/.agent/workflows/fix.md +68 -97
- package/.agent/workflows/generate.md +165 -164
- package/.agent/workflows/migrate.md +106 -109
- package/.agent/workflows/orchestrate.md +103 -86
- package/.agent/workflows/performance-benchmarker.md +77 -268
- package/.agent/workflows/plan.md +120 -98
- package/.agent/workflows/preview.md +39 -96
- package/.agent/workflows/refactor.md +105 -97
- package/.agent/workflows/review-ai.md +63 -102
- package/.agent/workflows/review.md +71 -110
- package/.agent/workflows/session.md +53 -113
- package/.agent/workflows/status.md +42 -88
- package/.agent/workflows/strengthen-skills.md +90 -51
- package/.agent/workflows/swarm.md +114 -129
- package/.agent/workflows/test.md +125 -102
- package/.agent/workflows/tribunal-backend.md +60 -78
- package/.agent/workflows/tribunal-database.md +62 -100
- package/.agent/workflows/tribunal-frontend.md +62 -82
- package/.agent/workflows/tribunal-full.md +56 -100
- package/.agent/workflows/tribunal-mobile.md +65 -94
- package/.agent/workflows/tribunal-performance.md +62 -105
- package/.agent/workflows/ui-ux-pro-max.md +72 -121
- package/README.md +11 -15
- package/package.json +1 -1
- package/.agent/skills/api-patterns/api-style.md +0 -42
- package/.agent/skills/api-patterns/auth.md +0 -24
- package/.agent/skills/api-patterns/documentation.md +0 -26
- package/.agent/skills/api-patterns/graphql.md +0 -41
- package/.agent/skills/api-patterns/rate-limiting.md +0 -31
- package/.agent/skills/api-patterns/response.md +0 -37
- package/.agent/skills/api-patterns/rest.md +0 -40
- package/.agent/skills/api-patterns/security-testing.md +0 -122
- package/.agent/skills/api-patterns/trpc.md +0 -41
- package/.agent/skills/api-patterns/versioning.md +0 -22
- package/.agent/skills/app-builder/agent-coordination.md +0 -71
- package/.agent/skills/app-builder/feature-building.md +0 -53
- package/.agent/skills/app-builder/project-detection.md +0 -34
- package/.agent/skills/app-builder/scaffolding.md +0 -118
- package/.agent/skills/app-builder/tech-stack.md +0 -40
- package/.agent/skills/architecture/context-discovery.md +0 -43
- package/.agent/skills/architecture/examples.md +0 -94
- package/.agent/skills/architecture/pattern-selection.md +0 -68
- package/.agent/skills/architecture/patterns-reference.md +0 -50
- package/.agent/skills/architecture/trade-off-analysis.md +0 -77
- package/.agent/skills/brainstorming/dynamic-questioning.md +0 -360
- package/.agent/skills/database-design/database-selection.md +0 -43
- package/.agent/skills/database-design/indexing.md +0 -39
- package/.agent/skills/database-design/migrations.md +0 -48
- package/.agent/skills/database-design/optimization.md +0 -36
- package/.agent/skills/database-design/orm-selection.md +0 -30
- package/.agent/skills/database-design/schema-design.md +0 -56
- package/.agent/skills/dotnet-core-expert/SKILL.md +0 -103
- package/.agent/skills/framer-motion-animations/SKILL.md +0 -74
- package/.agent/skills/frontend-design/animation-guide.md +0 -331
- package/.agent/skills/frontend-design/color-system.md +0 -329
- package/.agent/skills/frontend-design/decision-trees.md +0 -418
- package/.agent/skills/frontend-design/motion-graphics.md +0 -306
- package/.agent/skills/frontend-design/typography-system.md +0 -363
- package/.agent/skills/frontend-design/ux-psychology.md +0 -1116
- package/.agent/skills/frontend-design/visual-effects.md +0 -383
- package/.agent/skills/game-development/2d-games/SKILL.md +0 -119
- package/.agent/skills/game-development/3d-games/SKILL.md +0 -135
- package/.agent/skills/game-development/SKILL.md +0 -236
- package/.agent/skills/game-development/game-art/SKILL.md +0 -185
- package/.agent/skills/game-development/game-audio/SKILL.md +0 -190
- package/.agent/skills/game-development/game-design/SKILL.md +0 -129
- package/.agent/skills/game-development/mobile-games/SKILL.md +0 -108
- package/.agent/skills/game-development/multiplayer/SKILL.md +0 -132
- package/.agent/skills/game-development/pc-games/SKILL.md +0 -144
- package/.agent/skills/game-development/vr-ar/SKILL.md +0 -123
- package/.agent/skills/game-development/web-games/SKILL.md +0 -150
- package/.agent/skills/intelligent-routing/router-manifest.md +0 -65
- package/.agent/skills/mobile-design/decision-trees.md +0 -516
- package/.agent/skills/mobile-design/mobile-backend.md +0 -491
- package/.agent/skills/mobile-design/mobile-color-system.md +0 -420
- package/.agent/skills/mobile-design/mobile-debugging.md +0 -122
- package/.agent/skills/mobile-design/mobile-design-thinking.md +0 -357
- package/.agent/skills/mobile-design/mobile-navigation.md +0 -458
- package/.agent/skills/mobile-design/mobile-performance.md +0 -767
- package/.agent/skills/mobile-design/mobile-testing.md +0 -356
- package/.agent/skills/mobile-design/mobile-typography.md +0 -433
- package/.agent/skills/mobile-design/platform-android.md +0 -666
- package/.agent/skills/mobile-design/platform-ios.md +0 -561
- package/.agent/skills/mobile-design/touch-psychology.md +0 -537
- package/.agent/skills/nextjs-react-expert/1-async-eliminating-waterfalls.md +0 -312
- package/.agent/skills/nextjs-react-expert/2-bundle-bundle-size-optimization.md +0 -240
- package/.agent/skills/nextjs-react-expert/3-server-server-side-performance.md +0 -490
- package/.agent/skills/nextjs-react-expert/4-client-client-side-data-fetching.md +0 -264
- package/.agent/skills/nextjs-react-expert/5-rerender-re-render-optimization.md +0 -581
- package/.agent/skills/nextjs-react-expert/6-rendering-rendering-performance.md +0 -432
- package/.agent/skills/nextjs-react-expert/7-js-javascript-performance.md +0 -684
- package/.agent/skills/nextjs-react-expert/8-advanced-advanced-patterns.md +0 -150
- package/.agent/skills/vulnerability-scanner/checklists.md +0 -121
|
@@ -1,232 +1,516 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: tailwind-patterns
|
|
3
|
-
description: Tailwind CSS v4+
|
|
3
|
+
description: Tailwind CSS v4+ mastery. CSS-first configuration, @theme directive, container queries, scroll-driven animations, logical properties, clamp(), fluid typography, responsive design, dark mode, custom variants, component extraction, and performance optimization. Use when styling with Tailwind, building design systems, or optimizing CSS output.
|
|
4
4
|
allowed-tools: Read, Write, Edit, Glob, Grep
|
|
5
|
-
version:
|
|
6
|
-
last-updated: 2026-
|
|
5
|
+
version: 2.0.0
|
|
6
|
+
last-updated: 2026-04-01
|
|
7
7
|
applies-to-model: gemini-2.5-pro, claude-3-7-sonnet
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
# Tailwind CSS v4+
|
|
11
|
-
|
|
12
|
-
> Tailwind is not inline styles. It is a highly-tuned, statically extracted token constraint system.
|
|
13
|
-
> The moment you write arbitrary values everywhere (`w-[317px]`), you've lost the benefit. The moment you ignore CSS-first `@theme`, you are writing legacy code.
|
|
10
|
+
# Tailwind CSS v4+ โ CSS-First Mastery
|
|
14
11
|
|
|
15
12
|
---
|
|
16
13
|
|
|
17
|
-
## v4
|
|
14
|
+
## v4 Configuration (CSS-First)
|
|
18
15
|
|
|
19
|
-
|
|
16
|
+
### The @theme Directive
|
|
20
17
|
|
|
21
18
|
```css
|
|
22
|
-
/*
|
|
19
|
+
/* app.css โ THE configuration file in Tailwind v4 */
|
|
23
20
|
@import "tailwindcss";
|
|
24
21
|
|
|
25
22
|
@theme {
|
|
26
|
-
/*
|
|
27
|
-
--
|
|
28
|
-
|
|
29
|
-
--color-
|
|
30
|
-
--color-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
--
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
--
|
|
23
|
+
/* Colors */
|
|
24
|
+
--color-primary-50: oklch(0.97 0.02 250);
|
|
25
|
+
--color-primary-100: oklch(0.93 0.04 250);
|
|
26
|
+
--color-primary-500: oklch(0.55 0.18 250);
|
|
27
|
+
--color-primary-600: oklch(0.48 0.18 250);
|
|
28
|
+
--color-primary-700: oklch(0.40 0.16 250);
|
|
29
|
+
--color-primary-900: oklch(0.25 0.10 250);
|
|
30
|
+
|
|
31
|
+
--color-surface: oklch(0.99 0.00 0);
|
|
32
|
+
--color-surface-alt: oklch(0.96 0.00 0);
|
|
33
|
+
--color-text: oklch(0.15 0.00 0);
|
|
34
|
+
--color-text-muted: oklch(0.45 0.00 0);
|
|
35
|
+
|
|
36
|
+
/* Typography */
|
|
37
|
+
--font-sans: "Inter", "system-ui", sans-serif;
|
|
38
|
+
--font-mono: "JetBrains Mono", monospace;
|
|
39
|
+
|
|
40
|
+
/* Spacing (extends the default scale) */
|
|
41
|
+
--spacing-18: 4.5rem;
|
|
42
|
+
--spacing-88: 22rem;
|
|
43
|
+
|
|
44
|
+
/* Border radius */
|
|
45
|
+
--radius-pill: 9999px;
|
|
46
|
+
--radius-card: 1rem;
|
|
47
|
+
|
|
48
|
+
/* Shadows */
|
|
49
|
+
--shadow-card: 0 1px 3px oklch(0 0 0 / 0.08), 0 1px 2px oklch(0 0 0 / 0.06);
|
|
50
|
+
--shadow-elevated: 0 10px 25px oklch(0 0 0 / 0.1), 0 4px 10px oklch(0 0 0 / 0.05);
|
|
51
|
+
|
|
52
|
+
/* Animations */
|
|
53
|
+
--animate-fade-in: fade-in 0.3s ease-out;
|
|
54
|
+
--animate-slide-up: slide-up 0.4s cubic-bezier(0.16, 1, 0.3, 1);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@keyframes fade-in {
|
|
58
|
+
from { opacity: 0; }
|
|
59
|
+
to { opacity: 1; }
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@keyframes slide-up {
|
|
63
|
+
from { opacity: 0; transform: translateY(12px); }
|
|
64
|
+
to { opacity: 1; transform: translateY(0); }
|
|
38
65
|
}
|
|
66
|
+
|
|
67
|
+
/* โ HALLUCINATION TRAP: Tailwind v4 does NOT use tailwind.config.js
|
|
68
|
+
โ module.exports = { theme: { extend: { ... } } } โ REMOVED in v4
|
|
69
|
+
โ
Use @theme { } directive in your CSS file
|
|
70
|
+
โ
@import "tailwindcss" replaces the three @tailwind directives */
|
|
39
71
|
```
|
|
40
72
|
|
|
41
|
-
|
|
73
|
+
### Dark Mode
|
|
42
74
|
|
|
43
|
-
|
|
75
|
+
```css
|
|
76
|
+
/* Tailwind v4 dark mode with @theme */
|
|
77
|
+
@theme {
|
|
78
|
+
--color-surface: oklch(0.99 0.00 0);
|
|
79
|
+
--color-text: oklch(0.15 0.00 0);
|
|
80
|
+
}
|
|
44
81
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
82
|
+
/* Dark variant โ override variables */
|
|
83
|
+
@variant dark {
|
|
84
|
+
@theme {
|
|
85
|
+
--color-surface: oklch(0.13 0.02 260);
|
|
86
|
+
--color-text: oklch(0.93 0.00 0);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
50
89
|
|
|
51
|
-
|
|
52
|
-
|
|
90
|
+
/* Usage in HTML: */
|
|
91
|
+
/* <div class="bg-surface text-text dark:bg-surface dark:text-text"> */
|
|
92
|
+
/* With the @variant dark override, classes "just work" in dark mode */
|
|
93
|
+
```
|
|
53
94
|
|
|
54
95
|
```html
|
|
55
|
-
<!--
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
96
|
+
<!-- Dark mode toggle pattern -->
|
|
97
|
+
<html class="dark">
|
|
98
|
+
<body class="bg-surface text-text transition-colors duration-300">
|
|
99
|
+
<!-- Automatically uses dark @theme values -->
|
|
100
|
+
</body>
|
|
101
|
+
</html>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Custom Variants
|
|
105
|
+
|
|
106
|
+
```css
|
|
107
|
+
/* @variant โ custom selector-based variants */
|
|
108
|
+
@variant scrolled (&:where([data-scrolled]));
|
|
109
|
+
@variant hocus (&:hover, &:focus-visible);
|
|
110
|
+
|
|
111
|
+
/* Usage: */
|
|
112
|
+
/* <nav class="scrolled:shadow-elevated hocus:ring-2"> */
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Layout Patterns
|
|
118
|
+
|
|
119
|
+
### Flexbox
|
|
120
|
+
|
|
121
|
+
```html
|
|
122
|
+
<!-- Centered hero -->
|
|
123
|
+
<section class="flex min-h-svh flex-col items-center justify-center gap-6 px-6">
|
|
124
|
+
<h1 class="text-5xl font-bold tracking-tight">Hero Title</h1>
|
|
125
|
+
<p class="max-w-2xl text-center text-lg text-text-muted">Subtitle text</p>
|
|
126
|
+
<div class="flex gap-3">
|
|
127
|
+
<button class="rounded-pill bg-primary-600 px-6 py-3 text-white">Primary</button>
|
|
128
|
+
<button class="rounded-pill border border-primary-600 px-6 py-3 text-primary-600">Secondary</button>
|
|
60
129
|
</div>
|
|
130
|
+
</section>
|
|
131
|
+
|
|
132
|
+
<!-- Sidebar layout -->
|
|
133
|
+
<div class="flex min-h-svh">
|
|
134
|
+
<aside class="w-64 shrink-0 border-r border-gray-200 p-4">Sidebar</aside>
|
|
135
|
+
<main class="flex-1 overflow-y-auto p-6">Content</main>
|
|
61
136
|
</div>
|
|
137
|
+
|
|
138
|
+
<!-- โ HALLUCINATION TRAP: Use min-h-svh (small viewport height), NOT min-h-screen
|
|
139
|
+
min-h-screen = 100vh (broken on mobile โ includes browser chrome)
|
|
140
|
+
min-h-svh = 100svh (accounts for mobile browser chrome)
|
|
141
|
+
min-h-dvh = 100dvh (dynamic โ updates as chrome shows/hides) -->
|
|
62
142
|
```
|
|
63
143
|
|
|
64
|
-
|
|
65
|
-
*(Always use `// VERIFY: CSS Style Queries browser support` if heavily relying on them).*
|
|
144
|
+
### CSS Grid
|
|
66
145
|
|
|
67
|
-
|
|
68
|
-
|
|
146
|
+
```html
|
|
147
|
+
<!-- Auto-fit responsive grid (no breakpoints needed) -->
|
|
148
|
+
<div class="grid grid-cols-[repeat(auto-fit,minmax(280px,1fr))] gap-6">
|
|
149
|
+
<div class="rounded-card bg-surface p-6 shadow-card">Card 1</div>
|
|
150
|
+
<div class="rounded-card bg-surface p-6 shadow-card">Card 2</div>
|
|
151
|
+
<div class="rounded-card bg-surface p-6 shadow-card">Card 3</div>
|
|
152
|
+
</div>
|
|
69
153
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
154
|
+
<!-- Dashboard grid with named areas -->
|
|
155
|
+
<div class="grid grid-cols-[240px_1fr] grid-rows-[64px_1fr] min-h-svh">
|
|
156
|
+
<header class="col-span-2 border-b">Header</header>
|
|
157
|
+
<aside class="border-r p-4">Sidebar</aside>
|
|
158
|
+
<main class="overflow-y-auto p-6">Content</main>
|
|
159
|
+
</div>
|
|
160
|
+
|
|
161
|
+
<!-- Bento grid -->
|
|
162
|
+
<div class="grid auto-rows-[180px] grid-cols-3 gap-4">
|
|
163
|
+
<div class="col-span-2 row-span-2 rounded-2xl bg-primary-100">Large</div>
|
|
164
|
+
<div class="rounded-2xl bg-surface-alt">Small 1</div>
|
|
165
|
+
<div class="rounded-2xl bg-surface-alt">Small 2</div>
|
|
166
|
+
<div class="col-span-3 rounded-2xl bg-primary-50">Full width</div>
|
|
167
|
+
</div>
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Container Queries
|
|
171
|
+
|
|
172
|
+
```html
|
|
173
|
+
<!-- Container queries โ component-level responsiveness -->
|
|
174
|
+
<div class="@container">
|
|
175
|
+
<div class="flex flex-col gap-3 @sm:flex-row @sm:items-center @lg:gap-6">
|
|
176
|
+
<img class="size-16 rounded-full @sm:size-20" src="avatar.jpg" alt="">
|
|
177
|
+
<div>
|
|
178
|
+
<h3 class="text-lg font-semibold @lg:text-xl">User Name</h3>
|
|
179
|
+
<p class="text-sm text-text-muted @lg:text-base">Description</p>
|
|
180
|
+
</div>
|
|
181
|
+
</div>
|
|
182
|
+
</div>
|
|
183
|
+
|
|
184
|
+
<!-- Named container -->
|
|
185
|
+
<div class="@container/card">
|
|
186
|
+
<div class="@md/card:grid @md/card:grid-cols-2">
|
|
187
|
+
<!-- Responds to the card container's width, not viewport -->
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
|
|
191
|
+
<!-- โ HALLUCINATION TRAP: Container queries use @sm, @md, @lg (with @ prefix)
|
|
192
|
+
NOT sm:, md:, lg: โ those are VIEWPORT breakpoints
|
|
193
|
+
@sm = container >= 320px (component-level)
|
|
194
|
+
sm: = viewport >= 640px (page-level) -->
|
|
78
195
|
```
|
|
79
196
|
|
|
80
197
|
---
|
|
81
198
|
|
|
82
|
-
##
|
|
199
|
+
## Typography
|
|
200
|
+
|
|
201
|
+
### Fluid Typography with clamp()
|
|
202
|
+
|
|
203
|
+
```html
|
|
204
|
+
<!-- Fluid heading โ scales smoothly from 2rem to 4rem -->
|
|
205
|
+
<h1 class="text-[clamp(2rem,5vw,4rem)] font-bold leading-tight tracking-tight">
|
|
206
|
+
Responsive Heading
|
|
207
|
+
</h1>
|
|
208
|
+
|
|
209
|
+
<!-- Fluid body text -->
|
|
210
|
+
<p class="text-[clamp(1rem,1.2vw,1.25rem)] leading-relaxed text-text-muted">
|
|
211
|
+
Body text that scales with viewport
|
|
212
|
+
</p>
|
|
213
|
+
|
|
214
|
+
<!-- Prose (for long-form content) -->
|
|
215
|
+
<article class="prose prose-lg mx-auto max-w-3xl dark:prose-invert">
|
|
216
|
+
<!-- @tailwindcss/typography plugin handles all typography -->
|
|
217
|
+
<h1>Article Title</h1>
|
|
218
|
+
<p>Paragraph with <a href="#">links</a> and <code>code</code>.</p>
|
|
219
|
+
</article>
|
|
220
|
+
```
|
|
83
221
|
|
|
84
|
-
|
|
222
|
+
### Font Loading
|
|
85
223
|
|
|
86
224
|
```css
|
|
87
|
-
@
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
225
|
+
/* @font-face in your CSS (Tailwind v4 approach) */
|
|
226
|
+
@font-face {
|
|
227
|
+
font-family: "Inter";
|
|
228
|
+
font-weight: 100 900;
|
|
229
|
+
font-display: swap;
|
|
230
|
+
src: url("/fonts/inter-variable.woff2") format("woff2");
|
|
91
231
|
}
|
|
92
232
|
|
|
93
|
-
@
|
|
94
|
-
|
|
95
|
-
background: conic-gradient(from var(--angle), transparent, var(--color-brand-base));
|
|
96
|
-
animation: rotate 3s linear infinite;
|
|
97
|
-
}
|
|
233
|
+
@theme {
|
|
234
|
+
--font-sans: "Inter", system-ui, sans-serif;
|
|
98
235
|
}
|
|
99
|
-
@keyframes rotate { to { --angle: 360deg; } }
|
|
100
236
|
```
|
|
101
237
|
|
|
102
238
|
---
|
|
103
239
|
|
|
104
|
-
##
|
|
240
|
+
## Component Patterns
|
|
105
241
|
|
|
106
|
-
|
|
107
|
-
|---|---|---|
|
|
108
|
-
| `[400px]` arbitrary values | Breaks the constraint system | Add to `@theme` and use the token |
|
|
109
|
-
| `w-screen` / `h-screen` | Causes scrollbars / mobile jumps | Use `w-dvw` and `h-dvh` |
|
|
110
|
-
| `!important` | Specificity arms race | Correct the layer ordering or CSS specificity |
|
|
111
|
-
| String concatenation for classes | Tailwind purges them | Use `clsx` or `tailwind-merge` properly |
|
|
242
|
+
### Button System
|
|
112
243
|
|
|
113
|
-
|
|
244
|
+
```html
|
|
245
|
+
<!-- Base button with variants -->
|
|
246
|
+
<button class="inline-flex items-center justify-center gap-2 rounded-lg px-4 py-2.5
|
|
247
|
+
text-sm font-medium transition-all duration-150
|
|
248
|
+
focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-500
|
|
249
|
+
active:scale-[0.98] disabled:pointer-events-none disabled:opacity-50">
|
|
250
|
+
Button Text
|
|
251
|
+
</button>
|
|
252
|
+
|
|
253
|
+
<!-- Primary variant -->
|
|
254
|
+
<button class="... bg-primary-600 text-white shadow-sm hover:bg-primary-700">Primary</button>
|
|
255
|
+
|
|
256
|
+
<!-- Ghost variant -->
|
|
257
|
+
<button class="... text-text hover:bg-gray-100 dark:hover:bg-gray-800">Ghost</button>
|
|
258
|
+
|
|
259
|
+
<!-- Destructive variant -->
|
|
260
|
+
<button class="... bg-red-600 text-white hover:bg-red-700">Delete</button>
|
|
261
|
+
|
|
262
|
+
<!-- Icon button -->
|
|
263
|
+
<button class="grid size-10 place-items-center rounded-lg hover:bg-gray-100"
|
|
264
|
+
aria-label="Settings">
|
|
265
|
+
<svg class="size-5" ...></svg>
|
|
266
|
+
</button>
|
|
267
|
+
```
|
|
114
268
|
|
|
115
|
-
|
|
116
|
-
// โ Tailwind cannot detect this โ will be purged
|
|
117
|
-
const color = isDanger ? 'red' : 'green';
|
|
118
|
-
<div class={`bg-${color}-500`}>
|
|
269
|
+
### Input System
|
|
119
270
|
|
|
120
|
-
|
|
121
|
-
|
|
271
|
+
```html
|
|
272
|
+
<!-- Text input -->
|
|
273
|
+
<div class="space-y-1.5">
|
|
274
|
+
<label for="email" class="text-sm font-medium text-text">Email</label>
|
|
275
|
+
<input id="email" type="email" placeholder="you@example.com"
|
|
276
|
+
class="w-full rounded-lg border border-gray-300 bg-surface px-3.5 py-2.5
|
|
277
|
+
text-sm text-text placeholder:text-text-muted
|
|
278
|
+
transition-colors duration-150
|
|
279
|
+
focus:border-primary-500 focus:outline-none focus:ring-2 focus:ring-primary-500/20
|
|
280
|
+
disabled:cursor-not-allowed disabled:bg-gray-50 disabled:opacity-60"
|
|
281
|
+
/>
|
|
282
|
+
<p class="text-xs text-red-500">Error message here</p>
|
|
283
|
+
</div>
|
|
122
284
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
285
|
+
<!-- Checkbox -->
|
|
286
|
+
<label class="flex items-center gap-2.5 text-sm">
|
|
287
|
+
<input type="checkbox"
|
|
288
|
+
class="size-4 rounded border-gray-300 text-primary-600
|
|
289
|
+
focus:ring-2 focus:ring-primary-500/20" />
|
|
290
|
+
Remember me
|
|
291
|
+
</label>
|
|
130
292
|
```
|
|
131
293
|
|
|
132
|
-
|
|
294
|
+
### Card Pattern
|
|
133
295
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
296
|
+
```html
|
|
297
|
+
<div class="group overflow-hidden rounded-card bg-surface shadow-card
|
|
298
|
+
transition-shadow duration-200 hover:shadow-elevated">
|
|
299
|
+
<div class="aspect-video overflow-hidden bg-gray-100">
|
|
300
|
+
<img src="cover.jpg" alt="Cover"
|
|
301
|
+
class="size-full object-cover transition-transform duration-300
|
|
302
|
+
group-hover:scale-105" />
|
|
303
|
+
</div>
|
|
304
|
+
<div class="space-y-2 p-5">
|
|
305
|
+
<span class="inline-block rounded-full bg-primary-100 px-2.5 py-0.5
|
|
306
|
+
text-xs font-medium text-primary-700">Category</span>
|
|
307
|
+
<h3 class="text-lg font-semibold text-text line-clamp-2">Card Title</h3>
|
|
308
|
+
<p class="text-sm text-text-muted line-clamp-3">Description text...</p>
|
|
309
|
+
</div>
|
|
310
|
+
</div>
|
|
311
|
+
```
|
|
137
312
|
|
|
138
|
-
|
|
139
|
-
/* v4 dark mode via CSS media query */
|
|
140
|
-
@layer base {
|
|
141
|
-
:root {
|
|
142
|
-
--color-bg: oklch(98% 0.002 250);
|
|
143
|
-
--color-text: oklch(15% 0.005 250);
|
|
144
|
-
}
|
|
313
|
+
### Modal / Dialog
|
|
145
314
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
315
|
+
```html
|
|
316
|
+
<!-- Backdrop -->
|
|
317
|
+
<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/50
|
|
318
|
+
backdrop-blur-sm animate-fade-in">
|
|
319
|
+
<!-- Modal -->
|
|
320
|
+
<div class="w-full max-w-md rounded-2xl bg-surface p-6 shadow-elevated animate-slide-up"
|
|
321
|
+
role="dialog" aria-modal="true" aria-labelledby="modal-title">
|
|
322
|
+
<h2 id="modal-title" class="text-lg font-semibold">Dialog Title</h2>
|
|
323
|
+
<p class="mt-2 text-sm text-text-muted">Dialog description.</p>
|
|
324
|
+
|
|
325
|
+
<div class="mt-6 flex justify-end gap-3">
|
|
326
|
+
<button class="rounded-lg px-4 py-2 text-sm hover:bg-gray-100">Cancel</button>
|
|
327
|
+
<button class="rounded-lg bg-primary-600 px-4 py-2 text-sm text-white
|
|
328
|
+
hover:bg-primary-700">Confirm</button>
|
|
329
|
+
</div>
|
|
330
|
+
</div>
|
|
331
|
+
</div>
|
|
154
332
|
```
|
|
155
333
|
|
|
156
334
|
---
|
|
157
335
|
|
|
158
|
-
##
|
|
159
|
-
- **Mathematical Spacing:** Tailwind is a constraint system. You MUST use exact 4px grid steps (`p-4`, `gap-6`, `my-2`) to implement UI. Never guess spacing.
|
|
160
|
-
- **Explicit Layouts:** Every container must have explicit layout boundaries (`flex items-center justify-between` or `grid cols-3 gap-4`).
|
|
161
|
-
- **Boundaries:** Define constraints heavily (`w-full`, `max-w-screen-xl`, `overflow-hidden`).
|
|
336
|
+
## Responsive Design Rules
|
|
162
337
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
- **Validate DOM Depth:** Tailwind encourages flat HTML. Avoid nested `<div class="flex">` chains that go 10 layers deep; rebuild with CSS Grid.
|
|
338
|
+
```html
|
|
339
|
+
<!-- Tailwind breakpoints (mobile-first) -->
|
|
340
|
+
<!-- sm: 640px โ md: 768px โ lg: 1024px โ xl: 1280px โ 2xl: 1536px -->
|
|
167
341
|
|
|
168
|
-
|
|
342
|
+
<!-- Stack on mobile, row on tablet+ -->
|
|
343
|
+
<div class="flex flex-col gap-4 md:flex-row md:items-center">
|
|
344
|
+
<div class="md:w-1/2">Left</div>
|
|
345
|
+
<div class="md:w-1/2">Right</div>
|
|
346
|
+
</div>
|
|
169
347
|
|
|
170
|
-
|
|
348
|
+
<!-- Hide/show at breakpoints -->
|
|
349
|
+
<nav class="hidden lg:flex">Desktop nav</nav>
|
|
350
|
+
<button class="lg:hidden">โฐ Mobile menu</button>
|
|
171
351
|
|
|
172
|
-
|
|
352
|
+
<!-- Responsive padding -->
|
|
353
|
+
<section class="px-4 py-12 sm:px-6 lg:px-8 lg:py-24">
|
|
354
|
+
<div class="mx-auto max-w-7xl">Content</div>
|
|
355
|
+
</section>
|
|
173
356
|
|
|
357
|
+
<!-- Responsive grid -->
|
|
358
|
+
<div class="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">
|
|
359
|
+
<!-- Cards -->
|
|
360
|
+
</div>
|
|
174
361
|
```
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
## Animations & Transitions
|
|
366
|
+
|
|
367
|
+
### Transition Utilities
|
|
368
|
+
|
|
369
|
+
```html
|
|
370
|
+
<!-- Smooth hover transitions -->
|
|
371
|
+
<a class="text-text-muted transition-colors duration-150 hover:text-primary-600">Link</a>
|
|
372
|
+
|
|
373
|
+
<!-- Transform transitions -->
|
|
374
|
+
<div class="transition-transform duration-300 hover:-translate-y-1 hover:scale-105">
|
|
375
|
+
Hover me
|
|
376
|
+
</div>
|
|
377
|
+
|
|
378
|
+
<!-- Combined transition -->
|
|
379
|
+
<button class="rounded-lg bg-primary-600 px-4 py-2 text-white
|
|
380
|
+
transition-all duration-200
|
|
381
|
+
hover:bg-primary-700 hover:shadow-lg
|
|
382
|
+
active:scale-95">
|
|
383
|
+
Click me
|
|
384
|
+
</button>
|
|
186
385
|
```
|
|
187
386
|
|
|
188
|
-
|
|
189
|
-
Do not mark status as VERIFIED until concrete terminal evidence is provided.
|
|
387
|
+
### Custom Keyframe Animations
|
|
190
388
|
|
|
389
|
+
```css
|
|
390
|
+
@theme {
|
|
391
|
+
--animate-bounce-in: bounce-in 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
|
|
392
|
+
--animate-spin-slow: spin 3s linear infinite;
|
|
393
|
+
--animate-pulse-soft: pulse-soft 2s ease-in-out infinite;
|
|
394
|
+
}
|
|
191
395
|
|
|
396
|
+
@keyframes bounce-in {
|
|
397
|
+
0% { opacity: 0; transform: scale(0.3); }
|
|
398
|
+
50% { transform: scale(1.05); }
|
|
399
|
+
70% { transform: scale(0.9); }
|
|
400
|
+
100% { opacity: 1; transform: scale(1); }
|
|
401
|
+
}
|
|
192
402
|
|
|
193
|
-
|
|
403
|
+
@keyframes pulse-soft {
|
|
404
|
+
0%, 100% { opacity: 1; }
|
|
405
|
+
50% { opacity: 0.7; }
|
|
406
|
+
}
|
|
407
|
+
```
|
|
194
408
|
|
|
195
|
-
|
|
409
|
+
### Scroll-Driven Animations (CSS Native)
|
|
196
410
|
|
|
197
|
-
|
|
411
|
+
```css
|
|
412
|
+
/* Progress bar that fills as user scrolls */
|
|
413
|
+
.scroll-progress {
|
|
414
|
+
animation: grow-width linear;
|
|
415
|
+
animation-timeline: scroll();
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
@keyframes grow-width {
|
|
419
|
+
from { transform: scaleX(0); }
|
|
420
|
+
to { transform: scaleX(1); }
|
|
421
|
+
}
|
|
422
|
+
```
|
|
198
423
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
|
|
203
|
-
5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
|
|
424
|
+
```html
|
|
425
|
+
<div class="scroll-progress fixed top-0 left-0 z-50 h-1 w-full origin-left bg-primary-600"></div>
|
|
426
|
+
```
|
|
204
427
|
|
|
205
428
|
---
|
|
206
429
|
|
|
207
|
-
##
|
|
430
|
+
## Performance
|
|
208
431
|
|
|
209
|
-
|
|
210
|
-
**Active reviewers: `logic-reviewer` ยท `security-auditor`**
|
|
432
|
+
### Purging & Bundle Size
|
|
211
433
|
|
|
212
|
-
|
|
434
|
+
```css
|
|
435
|
+
/* Tailwind v4 automatically tree-shakes unused CSS at build time */
|
|
436
|
+
/* No manual purge configuration needed */
|
|
213
437
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
438
|
+
/* @source โ explicitly add content paths for scanning */
|
|
439
|
+
@source "../components/**/*.tsx";
|
|
440
|
+
@source "../pages/**/*.tsx";
|
|
217
441
|
|
|
218
|
-
|
|
442
|
+
/* โ HALLUCINATION TRAP: Tailwind v4 does NOT use purge: [] config
|
|
443
|
+
โ purge: ['./src/**/*.{html,tsx}'] โ REMOVED in v4
|
|
444
|
+
โ
Uses automatic content detection based on your project structure
|
|
445
|
+
โ
Use @source directive for custom paths */
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
### Avoiding Bloat
|
|
449
|
+
|
|
450
|
+
```html
|
|
451
|
+
<!-- โ
GOOD: Use component extraction for repeated patterns -->
|
|
452
|
+
<!-- Create a .btn class in CSS instead of repeating 15 utilities -->
|
|
219
453
|
|
|
220
|
-
|
|
454
|
+
<!-- โ BAD: One-off arbitrary values everywhere -->
|
|
455
|
+
<div class="mt-[13px] mr-[7px] p-[11px] text-[15px]">
|
|
456
|
+
<!-- Every arbitrary value = unique CSS rule = bundle bloat -->
|
|
457
|
+
</div>
|
|
458
|
+
|
|
459
|
+
<!-- โ
GOOD: Use your design scale -->
|
|
460
|
+
<div class="mt-3 mr-2 p-3 text-sm">
|
|
461
|
+
<!-- Maps to existing utilities = zero extra CSS -->
|
|
462
|
+
</div>
|
|
221
463
|
```
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
464
|
+
|
|
465
|
+
### Component Extraction (When to @apply)
|
|
466
|
+
|
|
467
|
+
```css
|
|
468
|
+
/* Use @apply ONLY for highly reused component patterns */
|
|
469
|
+
/* Do NOT @apply everything โ it defeats Tailwind's purpose */
|
|
470
|
+
|
|
471
|
+
.btn {
|
|
472
|
+
@apply inline-flex items-center justify-center gap-2 rounded-lg px-4 py-2.5
|
|
473
|
+
text-sm font-medium transition-all duration-150
|
|
474
|
+
focus-visible:outline-2 focus-visible:outline-offset-2
|
|
475
|
+
active:scale-[0.98] disabled:pointer-events-none disabled:opacity-50;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
.btn-primary {
|
|
479
|
+
@apply btn bg-primary-600 text-white shadow-sm hover:bg-primary-700
|
|
480
|
+
focus-visible:outline-primary-500;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
/* โ HALLUCINATION TRAP: @apply is for component patterns shared across files
|
|
484
|
+
If a pattern appears in only 1-2 places, just use inline utilities
|
|
485
|
+
Over-extracting with @apply = recreating regular CSS with extra steps */
|
|
226
486
|
```
|
|
227
487
|
|
|
228
|
-
|
|
488
|
+
---
|
|
229
489
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
490
|
+
## Accessibility with Tailwind
|
|
491
|
+
|
|
492
|
+
```html
|
|
493
|
+
<!-- Focus visible (keyboard only, not mouse click) -->
|
|
494
|
+
<a class="rounded-lg focus-visible:outline-2 focus-visible:outline-primary-500
|
|
495
|
+
focus-visible:outline-offset-2">
|
|
496
|
+
Keyboard accessible link
|
|
497
|
+
</a>
|
|
498
|
+
|
|
499
|
+
<!-- Screen reader only text -->
|
|
500
|
+
<button>
|
|
501
|
+
<svg class="size-5" aria-hidden="true"></svg>
|
|
502
|
+
<span class="sr-only">Close menu</span>
|
|
503
|
+
</button>
|
|
504
|
+
|
|
505
|
+
<!-- Motion-safe / motion-reduce -->
|
|
506
|
+
<div class="motion-safe:animate-bounce-in motion-reduce:animate-none">
|
|
507
|
+
<!-- Only animates if user hasn't enabled "reduce motion" -->
|
|
508
|
+
</div>
|
|
509
|
+
|
|
510
|
+
<!-- Forced colors mode (high contrast) -->
|
|
511
|
+
<button class="bg-primary-600 forced-colors:bg-[Highlight] forced-colors:text-[HighlightText]">
|
|
512
|
+
Accessible button
|
|
513
|
+
</button>
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
---
|