ui-designer/component-specification

SkillDev tools

UI component specification defining variants, sizes, and states for basic components such as buttons, inputs, and cards

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the ui-designer/component-specification skill

What this skill tells your AI

The instructions your AI receives, as published by echovic/boss-skill in skill/skills/ui-designer/component-specification/SKILL.md and read by ahel’s review.

适用场景

基于设计系统,定义可复用的UI组件规范,确保组件在不同场景下的一致性和完整性。

组件设计原则

  1. 完整性:考虑所有状态(默认、悬停、按下、聚焦、禁用、加载、错误)
  2. 一致性:同类组件使用相同的设计语言
  3. 可访问性:支持键盘导航、屏幕阅读器
  4. 响应式:适配不同屏幕尺寸

基础组件规范

1. 按钮 (Button)

变体
变体用途视觉特征
Primary主要操作(每个区域最多1个)实心,品牌色背景,白色文字
Secondary次要操作描边,透明背景,品牌色文字
Ghost低优先级操作无边框,透明背景,灰色文字
Danger危险操作(删除、清空)实心,红色背景,白色文字
Link文本链接无背景,品牌色文字,下划线
尺寸
尺寸高度内边距字号圆角最小宽度
sm32px12px 16px14px6px64px
md40px12px 20px16px8px80px
lg48px16px 24px16px8px96px
状态
状态Primary 背景Primary 文字边框其他
默认PrimaryWhite--
悬停Primary-hoverWhite-cursor: pointer
按下Primary-activeWhite-transform: scale(0.98)
聚焦PrimaryWhite2px Primary 外发光outline
禁用Gray-200Gray-400-cursor: not-allowed, opacity: 0.6
加载Primary--显示 spinner,文字隐藏
图标按钮
属性
尺寸32px / 40px / 48px(正方形)
图标大小16px / 20px / 24px
圆角radius-md 或 radius-full(圆形)
代码示例
// 主按钮
<Button variant="primary" size="md">确认</Button>

// 次要按钮
<Button variant="secondary" size="md">取消</Button>

// 危险按钮
<Button variant="danger" size="md">删除</Button>

// 禁用状态
<Button variant="primary" size="md" disabled>确认</Button>

// 加载状态
<Button variant="primary" size="md" loading>提交中</Button>

// 带图标
<Button variant="primary" size="md" icon={<IconCheck />}>保存</Button>

// 图标按钮
<IconButton variant="ghost" size="md" icon={<IconClose />} />

2. 输入框 (Input)

尺寸
尺寸高度内边距字号圆角
sm32px8px 12px14px6px
md40px10px 14px16px8px
lg48px12px 16px16px8px
状态
状态边框颜色背景色其他
默认Gray-300White-
悬停Gray-400White-
聚焦PrimaryWhite2px Primary 外发光
错误ErrorWhite显示错误提示
禁用Gray-200Gray-50cursor: not-allowed
只读Gray-200Gray-50-
组成部分
┌─────────────────────────────────────────┐
│ [图标]  [输入内容]            [清除按钮] │
└─────────────────────────────────────────┘
  前缀      输入区域               后缀
  • 前缀:图标、文字(如"https://")
  • 输入区域:用户输入的内容
  • 后缀:清除按钮、单位(如"元")、操作按钮
变体
变体说明
Text单行文本输入
Textarea多行文本输入
Password密码输入(带显示/隐藏切换)
Number数字输入(带增减按钮)
Search搜索输入(带搜索图标和清除按钮)
代码示例
// 基础输入框
<Input placeholder="请输入用户名" />

// 带标签
<Input label="用户名" placeholder="请输入用户名" />

// 带前缀图标
<Input prefix={<IconUser />} placeholder="请输入用户名" />

// 带后缀清除按钮
<Input clearable placeholder="请输入关键词" />

// 错误状态
<Input error="用户名不能为空" />

// 禁用状态
<Input disabled value="已禁用" />

// 多行文本
<Textarea rows={4} placeholder="请输入描述" />

// 密码输入
<Input type="password" placeholder="请输入密码" />

// 搜索输入
<Input type="search" placeholder="搜索..." />

3. 选择器 (Select)

尺寸

与Input保持一致(sm / md / lg)

状态

与Input保持一致

下拉菜单
属性
最大高度256px(超出滚动)
背景White
阴影shadow-lg
圆角radius-md
选项高度40px
选项内边距10px 14px
选项状态
状态背景色文字颜色
默认WhiteGray-700
悬停Gray-50Gray-900
选中Primary-lightPrimary
禁用WhiteGray-400

4. 复选框 (Checkbox)

尺寸
尺寸大小勾选图标
sm16px12px
md20px14px
lg24px16px
状态
状态边框背景勾选图标
未选中Gray-300White-
选中PrimaryPrimaryWhite
半选中PrimaryPrimaryWhite(横线)
禁用-未选中Gray-200Gray-50-
禁用-选中Gray-300Gray-300White

5. 单选框 (Radio)

尺寸

与Checkbox保持一致

状态
状态边框背景内圆
未选中Gray-300White-
选中PrimaryWhitePrimary(8px圆点)
禁用-未选中Gray-200Gray-50-
禁用-选中Gray-300Gray-50Gray-300

6. 开关 (Switch)

尺寸
尺寸宽度高度圆点大小
sm32px18px14px
md44px24px20px
lg56px30px26px
状态
状态背景圆点位置
关闭Gray-300左侧
开启Primary右侧
禁用-关闭Gray-200左侧
禁用-开启Primary(opacity: 0.5)右侧

7. 卡片 (Card)

规格
属性
背景White
圆角radius-lg (12px)
阴影shadow-md
内边距space-6 (24px)
边框可选,1px Gray-200
变体
变体特征用途
默认阴影普通内容卡片
描边1px Gray-200 边框,无阴影表单区域
可点击hover 时阴影加深,cursor: pointer列表项、导航卡片
可选中选中时边框变为 Primary选择卡片
组成部分
┌─────────────────────────────────────┐
│  [图片/图标]                         │
│                                     │
│  标题                                │
│  描述文字                            │
│                                     │
│  [操作按钮]                          │
└─────────────────────────────────────┘

8. 标签 (Tag)

尺寸
尺寸高度内边距字号
sm20px4px 8px12px
md24px6px 10px14px
lg28px8px 12px14px
变体
变体背景文字边框
默认Gray-100Gray-700-
PrimaryPrimary-lightPrimary-
SuccessSuccess-lightSuccess-
WarningWarning-lightWarning-
ErrorError-lightError-
描边WhiteGray-7001px Gray-300

9. 徽章 (Badge)

尺寸
尺寸大小字号
sm16px10px
md20px12px
lg24px14px
变体
变体背景文字
PrimaryPrimaryWhite
SuccessSuccessWhite
WarningWarningWhite
ErrorErrorWhite
圆点纯色圆点,无文字-

10. 提示框 (Tooltip)

规格
属性
背景Gray-900
文字White
字号14px
内边距6px 12px
圆角radius-md
最大宽度320px
箭头大小6px
位置
  • top / bottom / left / right
  • 自动调整位置避免溢出

输出要求

在UI设计文档中,应包含以下组件规范章节:

## 5. 组件规范

### 5.1 按钮 (Button)
[变体、尺寸、状态表格 + 代码示例]

### 5.2 输入框 (Input)
[尺寸、状态、变体表格 + 代码示例]

### 5.3 [其他组件...]
[根据具体需求补充]

关键原则

  1. 状态完整:每个组件都要考虑所有状态
  2. 一致性:同类组件使用相同的设计语言
  3. 可访问性:支持键盘导航、屏幕阅读器
  4. 文档化:提供清晰的代码示例

常见误区

状态不全:只设计默认状态,忽略悬停、禁用等 ❌ 尺寸不统一:不同组件的尺寸不对齐 ❌ 缺少文档:只有视觉稿,没有规范说明 ❌ 不考虑边界:没有考虑长文本、空状态等边界情况

Signals

GitHub stars
555
Forks
50
Last commit
Sep 2026
Advanced
Catalog kind
skill
Gateway key
ui-designer-component-specification
Source
github.com/echovic/boss-skill