ss-component
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseUI Component Generator
UI组件生成器
When NOT to use
不适用于以下场景
- For full-page scaffolding → use
/ss-page - For composed multi-component patterns → use
/ss-pattern - For tweaking an existing component — just edit the file directly
- For non-StyleSeed projects (no directory or no Tailwind v4)
components/ui/
Generate a new component: $0
Description: $ARGUMENTS
- 全页面脚手架 → 使用
/ss-page - 多组件组合模式 → 使用
/ss-pattern - 调整现有组件 — 直接编辑文件即可
- 非StyleSeed项目(无目录或未使用Tailwind v4)
components/ui/
生成新组件:$0
描述:$ARGUMENTS
Instructions
操作说明
-
First, read the compiled design method:
- Read and
.styleseed/effective-rules.md; resolve if stale.styleseed/manifest.json - Read for available design tokens
css/theme.css - Read for morphology variables and helper classes
css/recipes.css - Read as a reference pattern
components/ui/button.tsx
- Read
-
Follow these conventions strictly:
- Use declaration (not
function)const - Add attribute
data-slot="component-name" - Use from
cn()for all className merging@/components/ui/utils - Use for prop typing
React.ComponentProps<> - Always support prop for overrides
className - Use CVA () if the component has variants
class-variance-authority - Use semantic color tokens (,
bg-card) — never inline hextext-foreground
- Use
-
Design token usage:
- Colors: ,
text-foreground,bg-card,text-brand,text-muted-foregroundborder-border - Pattern surfaces: ; insets/controls/icons use the matching
ss-pattern-surfaceclassss-* - Primitives use the project token scale; do not hardcode one radius or shadow personality
- Spacing follows one repeatable selected-recipe rhythm
- Motion: ,
duration-[var(--duration-fast)]ease-[var(--ease-default)]
- Colors:
-
Typography rules:
- Display (36-48px):
leading-none tracking-[-0.02em] - Heading (18-24px):
leading-snug tracking-[-0.01em] - Body (14-17px): (default tracking)
leading-normal - Caption uppercase (10-13px):
tracking-[0.05em] - Use shorthand instead of
size-*w-* h-* - Use instead of
ms-*/me-*(logical properties)ml-*/mr-*
- Display (36-48px):
-
Accessibility requirements:
- Minimum touch target: 44x44px ()
min-h-11 min-w-11 - Support attributes passthrough
aria-* - Use for keyboard focus
focus-visible:ring-2 focus-visible:ring-ring - Respect for animations
prefers-reduced-motion
- Minimum touch target: 44x44px (
-
Export the component as a named export (not default)
-
Place the file in the appropriate directory:
- Primitive/reusable →
src/components/ui/ - Composed pattern →
src/components/patterns/
- Primitive/reusable →
-
首先,阅读已编译的设计方法:
- 阅读和
.styleseed/effective-rules.md;若内容过期则更新.styleseed/manifest.json - 阅读了解可用的设计令牌
css/theme.css - 阅读了解形态变量和辅助类
css/recipes.css - 阅读作为参考示例
components/ui/button.tsx
- 阅读
-
严格遵循以下规范:
- 使用声明(而非
function)const - 添加属性
data-slot="component-name" - 使用中的
@/components/ui/utils处理所有className合并cn() - 使用进行属性类型定义
React.ComponentProps<> - 始终支持属性用于样式覆盖
className - 若组件包含变体,使用CVA()
class-variance-authority - 使用语义化颜色令牌(、
bg-card)—— 绝不使用内联十六进制颜色值text-foreground
- 使用
-
设计令牌使用规则:
- 颜色:、
text-foreground、bg-card、text-brand、text-muted-foregroundborder-border - 模式表面:;内嵌元素/控件/图标使用匹配的
ss-pattern-surface类ss-* - 基础组件使用项目令牌刻度;不要硬编码单一圆角或阴影样式
- 间距遵循选定的可重复配方节奏
- 动效:、
duration-[var(--duration-fast)]ease-[var(--ease-default)]
- 颜色:
-
排版规则:
- 展示型文字(36-48px):
leading-none tracking-[-0.02em] - 标题(18-24px):
leading-snug tracking-[-0.01em] - 正文(14-17px):(默认字间距)
leading-normal - 大写说明文字(10-13px):
tracking-[0.05em] - 使用简写替代
size-*w-* h-* - 使用替代
ms-*/me-*(逻辑属性)ml-*/mr-*
- 展示型文字(36-48px):
-
无障碍要求:
- 最小触摸目标:44x44px()
min-h-11 min-w-11 - 支持属性透传
aria-* - 键盘聚焦使用样式
focus-visible:ring-2 focus-visible:ring-ring - 动画需尊重设置
prefers-reduced-motion
- 最小触摸目标:44x44px(
-
以命名导出方式导出组件(而非默认导出)
-
将文件放置在合适的目录:
- 基础/可复用组件 →
src/components/ui/ - 组合模式组件 →
src/components/patterns/
- 基础/可复用组件 →