360 Secure SkillHub
360 安全技能中心

hig-components-controls

面向 Apple 平台应用的表单和输入控件,依据 HIG 参考内容给出控件选型理由、状态管理、校验方式和 VoiceOver 无障碍建议,并可按需读取项目设计上下文或检查现有代码。内容覆盖选择器、开关、滑块、步进器、分段控件、文本框、标签、令牌字段、仪表与评分指示器等。

分类:开发
raintree-technology
热度 0.00
最近更新 2026-11-29 11:15:06

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add raintree-technology/hig-doctor/hig-components-controls
兼容性
通用兼容
联网要求
不联网
数据出网
数据不出本机
Metadata
name
hig-components-controls
description
When the user builds forms or input controls in an Apple app: pickers, toggles, sliders, steppers, segmented controls, combo boxes, text fields, text views, labels, token fields, gauges, rating indicators, or keyboard types. For buttons and menus, see hig-components-menus. For search fields, see hig-components-search.
license
MIT. Apple HIG content is © Apple Inc.
metadata
{"version":"1.1.0","hig-snapshot":"2025-02-02"}

Apple HIG: Selection and Input Controls

Read .agents/apple-design-context.md (or the older .claude/apple-design-context.md) before asking questions. Use what it records and only ask for what is missing.

Key Principles

  1. Clear current state. Users must always see what is selected. Toggles show on/off, segmented controls highlight the active segment, pickers display the current selection.

  2. Prefer standard system controls. Built-in controls provide consistency and accessibility. Custom controls introduce a learning curve and may break assistive features.

  3. Toggles for binary states. On or off. In Settings-style screens, changes take effect immediately. In modal forms, changes commit on confirmation.

  4. Segmented controls for mutually exclusive options. 2-5 items, roughly equal importance, short labels.

  5. Sliders for continuous values. When precise numeric input is not critical. Provide min/max labels or icons for range endpoints.

  6. Pickers for long option lists. Too many options for a segmented control. Works well for dates, times, structured data.

  7. Steppers for small, precise adjustments. Increment/decrement in fixed steps. Display current value next to the stepper with reasonable min/max bounds.

  8. Text fields for short, single-line input. Text views for multi-line. Configure keyboard type to match expected input (email, URL, number).

  9. Combo boxes: text input + selection list. macOS. Type a value or choose from a predefined list when custom values are valid.

  10. Token fields: discrete values as visual tokens. macOS. For email recipients, tags, or collections of discrete items.

  11. Gauges and rating indicators display values. Gauges show a value within a range. Rating indicators show ratings (often stars). Display-only; use interactive variants for input.

Reference Index

Reference Topic Key content
controls.md General controls States, affordance, system controls
toggles.md Toggles On/off, immediate effect
segmented-controls.md Segmented controls 2-5 options, equal weight
sliders.md Sliders Continuous range, min/max labels
steppers.md Steppers Fixed steps, bounded values
pickers.md Pickers Dates, times, long option sets
combo-boxes.md Combo boxes macOS, type or select, custom values
text-fields.md Text fields Short input, keyboard types, validation
text-views.md Text views Multi-line, comments, descriptions
labels.md Labels Placement, VoiceOver support
token-fields.md Token fields macOS, chips, tags, recipients
virtual-keyboards.md Virtual keyboards Email, URL, number keyboard types
rating-indicators.md Rating indicators Star ratings, display-only
gauges.md Gauges Level indicators, range display

Check existing code

If the project has source code, run npx hig-doctor . (or the hig_audit_file MCP tool on one file) and cite its findings (rule ID, line, HIG link) alongside this guidance. Findings are review evidence, not proof of HIG conformance.

Output Format

  1. Control recommendation with rationale and why alternatives are less suitable.
  2. State management -- how the control communicates current state and whether changes apply immediately or on confirmation.
  3. Validation approach -- when to show errors and how to communicate rules.
  4. Accessibility -- labels, traits, hints for VoiceOver.

Questions to Ask

  1. What type of data? (Boolean, choice from fixed set, numeric, free-form text?)
  2. How many options?
  3. Which platforms? (Combo boxes and token fields are macOS-only)
  4. Settings screen or inline form?

Related Skills

  • hig-components-menus -- Buttons and pop-up buttons complementing selection controls
  • hig-components-dialogs -- Sheets and popovers containing forms
  • hig-components-search -- Search fields sharing text input patterns
  • hig-inputs -- Keyboard, pointer, gesture interactions with controls
  • hig-foundations -- Typography, color, layout for control styling