tailwind-ui
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTailwind UI Skill
Tailwind UI 技能指南
Tailwind CSS v4.1 development with accessibility and theming baked in.
内置可访问性与主题定制的 Tailwind CSS v4.1 开发指南。
Quick Reference
快速参考
v4.1 Critical Changes
v4.1 关键变更
Never use deprecated utilities — always use replacements:
| Deprecated | Replacement |
|---|---|
| |
| |
| |
| |
| |
| |
| |
| |
| Use |
| |
| Use |
切勿使用已弃用的工具类——请始终使用替代方案:
| 已弃用 | 替代方案 |
|---|---|
| |
| |
| |
| |
| |
| |
| |
| |
| 使用 |
| |
| 改用 |
Essential Patterns
核心组件模式
html
<!-- Gap over space utilities -->
<div class="flex gap-4">...</div>
<!-- Opacity modifiers -->
<div class="bg-primary-500/60">...</div>
<!-- Line height modifiers -->
<p class="text-base/7">...</p>
<!-- Dynamic viewport height (mobile-safe) -->
<div class="min-h-dvh">...</div>
<!-- Size utility for equal dimensions -->
<div class="size-12">...</div>html
<!-- 优先使用 Gap 而非 Space 工具类 -->
<div class="flex gap-4">...</div>
<!-- 透明度修饰符 -->
<div class="bg-primary-500/60">...</div>
<!-- 行高修饰符 -->
<p class="text-base/7">...</p>
<!-- 动态视口高度(移动端安全) -->
<div class="min-h-dvh">...</div>
<!-- 等尺寸工具类 -->
<div class="size-12">...</div>Reference Files
参考文档
Load these based on the task:
- references/v4-migration.md — Full v4.1 breaking changes, upgrade process, new features
- references/accessibility.md — WCAG 2.1 AA patterns: contrast, focus, screen readers
- references/theming.md — @theme setup, CSS variables, light/dark mode
- references/components.md — Accessible component patterns (buttons, forms, cards, nav)
根据任务需求加载以下文档:
- references/v4-migration.md — 完整的 v4.1 破坏性变更、升级流程及新功能说明
- references/accessibility.md — WCAG 2.1 AA 相关模式:对比度、焦点、屏幕阅读器适配
- references/theming.md — @theme 配置、CSS 变量、亮色/暗色模式
- references/components.md — 无障碍组件模式(按钮、表单、卡片、导航)
Theme Asset
主题资源
- assets/theme-starter.css — Starter @theme with primary/secondary/tertiary color scales
- assets/theme-starter.css — 包含主色/次色/第三色阶的 @theme 初始模板
Core Principles
核心原则
- Use Tailwind's scale — Avoid arbitrary values like ; use
ml-[16px]ml-4 - Never use @apply — Use CSS variables or framework components
- Gap over margins — Use in flex/grid, not
gap-*or child marginsspace-* - Test both modes — Always verify light AND dark mode appearance
- Accessibility first — Every interactive element needs visible focus states and proper contrast
- 使用 Tailwind 内置刻度值 — 避免使用 这类任意值;请使用
ml-[16px]ml-4 - 禁止使用 @apply — 改用 CSS 变量或框架组件
- 优先使用 Gap 而非外边距 — 在 flex/grid 布局中使用 ,而非
gap-*或子元素外边距space-* - 双模式测试 — 务必同时验证亮色与暗色模式的显示效果
- 可访问性优先 — 所有交互元素都需要可见的焦点状态及符合标准的对比度