Communitygithub.com

表单设计系统

为表单界面设计并记录一套系统化框架,定义其结构、空间组织与视觉提示,以确保一致性、可用性与可访问性。

表单设计系统 是什么?

该技能提供了一套完整的方法论,用于设计 Web 表单的视觉与空间框架。它专注于定义表单元素的“是什么”与“在哪里”,确保标签、输入框、选择项和操作按钮组织成可预测、可访问且高信任度的界面,从而降低用户认知负荷并防止出错。该技能适用于 UI 组件库设计、多步骤数据输入界面的视觉标准建立、现有表单的视觉审计,以及响应式表单布局的设计。它要求输入信息架构、设备断点、品牌样式和交互需求(如实时校验、文件上传),并输出包括输入组件视觉规范、布局蓝图、选择组件映射表和反馈与状态矩阵在内的详细设计产出。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/coastdigitalgroup/coastai-skills/tree/HEAD/website-design/form-design-system

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

表单设计系统 是做什么的?

目的

表单设计系统技能提供了一套设计 Web 表单视觉与空间框架的方法论。技术实现处理“如何做”,增长优化处理“为什么做”,而设计系统则定义了“做什么”和“在哪里做”。它确保表单元素——标签、输入框、选择项和操作按钮——被组织成一个可预测、可访问、高信任度的界面,从而降低认知负荷并防止用户出错。

使用场景

  • 为表单设计 UI 套件或设计系统组件库。
  • 为复杂的多步骤数据输入界面建立视觉标准。
  • 审计现有表单的视觉不一致性或空间交互问题。
  • 设计在多种设备上保持层级结构的响应式表单布局。
  • 标准化错误与验证的可视化模式。

何时不应使用

  • 通用搜索框: 简单的单输入搜索字段通常不需要完整的设计系统处理。
  • 实验性交互媒体: 当类似表单的交互是叙事或艺术体验的次要部分时。
  • 低风险微交互: 例如“赞/踩”或简单的开关按钮,不附带数据输入。

输入

  1. 信息结构: 要收集的具体数据点及其关系。
  2. 设备断点: 来自 responsive-grid-system 的响应式需求。
  3. 品牌样式: 来自 fluid-spacing-system 的排版尺度、颜色调色板和间距标记。
  4. 交互需求: 表单是否需要实时校验、文件上传或复杂选择项。

输出

  1. 输入组件规范: 标签、输入框、帮助文本、图标和错误消息的视觉定义。
  2. 布局蓝图: 字段分组、对齐方式(顶部 vs. 左侧)和操作按钮放置的空间规则。
  3. 选择组件映射图: 定义何时使用单选按钮、复选框、开关或下拉选择框。
  4. 反馈与状态矩阵: 悬停、聚焦、禁用、成功和错误状态的视觉处理方式。

工作流程

1. 定义组件结构

为每个“字段组”建立一致的结构。一个字段应包含:

  • 标签: 清晰、简洁的文本,用于标识字段。
  • 输入框: 交互容器(文本、下拉选择等)。
  • 帮助/说明文本: 持续存在的指导信息(例如“密码必须为 8 个字符”)。
  • 错误消息: 仅在验证失败时出现的上下文反馈。

2. 确定空间布局与对齐

确定标签与输入框之间的关系:

  • 顶部对齐标签(推荐): 最适合可扫描性和移动端响应式。
  • 左侧对齐标签: 仅用于垂直空间紧张的数据密集型桌面界面。
  • 分组: 组之间使用逻辑间距(例如 --space-l),组内使用较小间距(例如 --space-s)。

3. 选择交互模式

为数据类型分配 UI 模式:

  • 二选一选择: 使用复选框表示“是/否”或多选。
  • 互斥选择: 2–5 个选项使用单选按钮;6 个以上选项使用下拉选择框。
  • 即时开关: 使用开关按钮表示无需“提交”操作即可立即生效的设置。

4. 设计反馈循环

创建验证的视觉层级结构:

  • 聚焦状态: 使用高对比度环指示当前活动字段。
  • 错误状态: 使用颜色(通常为红色)、图标和边框粗细来提示错误。
  • 成功状态: 对高重要性字段(例如用户名的可用性)使用细微提示(如绿色勾号)。

5. 规划响应式适配

映射表单在较小视口下的适应方式:

  • 堆叠: 桌面端的多列布局必须在移动端堆叠为单列。
  • 触摸目标: 确保所有交互区域(单选按钮、复选框、按钮)至少为 24x24px(WCAG 2.2 SC 2.5.8 最低要求);首选为 44x44px,对于主要提交操作应设为默认。

决策规则

  • 单列规则: 大多数表单使用单列布局,以保持清晰的垂直扫描路径并减少眼部疲劳。
  • 标签对齐: 默认使用顶部对齐标签。它们可减少处理表单所需的眼部注视次数。
  • 占位符 vs. 标签: 切勿将占位符用作标签。标签必须在用户开始输入后仍然可见。
  • 按钮层级: 主要“提交”操作应视觉上最突出。次要操作(例如“取消”)应为文本链接或低对比度按钮。
  • 邻近性: 将帮助文本和错误消息尽可能靠近输入框放置(通常在其正下方)。

约束条件

  • 可访问性: 标签必须以编程方式与输入框关联(<label for> 或包裹)。文本和边框的对比度必须满足 WCAG AA(文本 4.5:1,UI 组件 3:1)。错误消息必须通过 aria-describedby 以编程方式与其输入框关联,无效字段必须设置 aria-invalid="true"。焦点指示器不得被固定页眉、提示框或覆盖层遮挡(WCAG 2.4.11 焦点不被遮挡)。
  • 响应式: 表单字段不得溢出其容器,也不得具有超过移动端视口的固定宽度。
  • 视觉层级: 错误消息必须在视觉上与帮助文本区分,以确保不会被忽略。

常见失败模式

  • “占位符标签”陷阱: 使用占位符代替标签,导致用户输入时丢失上下文。
  • 过多列布局: 使用多列布局,打乱用户自然的从上到下扫描路径。
  • 模糊的错误提示: 仅使用颜色显示错误(例如仅将边框变为红色),而没有图标或文本消息。
  • 小触摸目标: 设计的单选按钮或复选框过小,不适合在移动端用拇指交互。
  • “隐形”焦点: 未能提供清晰的焦点环,导致键盘用户无法导航。

验证标准

  • 每个输入框都具有持续可见的标签。
  • 表单遵循逻辑的单列垂直扫描路径。
  • 错误状态结合使用颜色、图标和文本。
  • 焦点指示器为高对比度且清晰可见。
  • 交互元素(输入框、按钮)满足 WCAG 2.2 24x24px 触摸目标最低要求(首选 44x44px)。
  • 布局在移动端视口下平滑过渡到单列。
  • 主要、次要和第三级操作具有清晰的视觉层级。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for progressive disclosure using accordions, ensuring structural integrity, visual affordances, and accessibility across different content densities and devices.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for long-form content, managing readability, vertical rhythm, and information density to ensure a superior reading experience.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for informational elements that communicate state (Badges) and categorization (Tags) with clarity and accessibility.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for non-overlay notifications, managing global announcements and contextual inline alerts to communicate system states without interrupting the user's flow.

coastdigitalgroup/coastai-skills

Design and implement a systematic, asymmetrical bento-grid layout framework to organize diverse content types cohesively while maintaining strict visual hierarchy, logical focus order, and responsive flexibility.

coastdigitalgroup/coastai-skills

Design a responsive, mobile-first bottom navigation bar and persistent action dock system for mobile websites and web applications, establishing spatial anchors, tab bar anatomy, badge indicators, thumb-zone ergonomics, safe area inset handling, active/inactive state contrast, and desktop responsive adaptation rules.

coastdigitalgroup/coastai-skills

Design a mobile-first bottom sheet overlay system with configurable detents, drag affordances, safe area padding, responsive desktop modal/popover adaptation, and WCAG AA accessibility compliance.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for secondary navigation trails that provide orientation, context, and one-click access to parent levels in deep information architectures.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for buttons and interactive triggers, managing visual hierarchy, variant logic, and action grouping to ensure clear intent and accessible interaction.

coastdigitalgroup/coastai-skills

Design a systematic framework for date and time selection, managing calendar grids, range pickers, and scheduling interfaces to ensure precision and accessibility.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for modular content containers that maintain hierarchy, structural integrity, and action alignment across variable content and responsive viewports.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for horizontal discovery components, managing navigation affordances, scroll behavior, and accessibility to ensure effective content density without compromising usability.

coastdigitalgroup/coastai-skills

Design a systematic, highly accessible, and developer-friendly UI layout framework for code blocks, snippet showcases, multi-file code tabs, line-highlighting, diff views, and syntax token contrast in technical documentation and developer platforms.

coastdigitalgroup/coastai-skills

Design a systematic framework for global command menus (Cmd+K panels) that combines keyboard-driven navigation, command execution, and shortcut discovery into an accessible, responsive overlay.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for threaded conversations, managing nesting depths, action hierarchies, and community signaling to foster engagement and readability.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for side-by-side comparison interfaces, managing high attribute density and responsive complexity to support informed decision-making.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for user privacy, managing consent banners, preference centers, and persistent privacy controls to balance legal compliance with user trust.

coastdigitalgroup/coastai-skills

Design and implement a systematic, highly accessible, and responsive visual layout framework for conversational chat widgets, live chat boxes, and chatbot panels that ensures clear message scannability, native focus flow, and seamless mobile keyboard adaptation.

coastdigitalgroup/coastai-skills

Design a systematic, accessible, and high-conversion framework for custom select dropdowns and comboboxes, defining anatomy, states, search-filtering, and responsive mobile-adaptive patterns.

coastdigitalgroup/coastai-skills

Design and implement a systematic color palette that ensures WCAG 2.2 accessibility compliance. Trigger this skill when asked to define brand colors, create UI themes, or establish a visual system for a website.

相关技能