# 05-forms-basic:checkbox / checkbox-group / radio-group / switch / slider / input / textarea / text-field / search-field 上游基线 ce90ea3(heroui/,只读)对照 heroui-vue/。路径均相对仓库根。示例名全局差异已由简报核过(仅 text-area↔textarea、text-field↔textfield 命名),下文不再重复。 ### checkbox - [示例] checkbox-form:提交反馈交互不同——UP 用 `alert(\`表单提交数据:\n…\`)`(heroui/apps/docs/src/demos/cn/checkbox/form.tsx L10-16),VUE 渲染行内结果 `

{{ result }}

`(heroui-vue/apps/docs/demos/checkbox-form.vue)。alert→行内输出为系统性差异(见小结)。 - [示例] checkbox-custom-indicator:自定义指示器图形不同——UP 为内联 SVG(心形 path、加号 `strokeWidth="3"`、半选横线,custom-indicator.tsx L15-70),VUE 用 Tabler `IconHeartFilled/IconPlus/IconMinus` 且无尺寸类(checkbox-custom-indicator.vue)。UP svg 无宽高按容器填充,Tabler 默认 24px,呈现不同。 - [示例] checkbox-group-with-custom-indicator:UP 内联 X SVG(`M6 18L18 6M6 6l12 12`,checkbox-group/with-custom-indicator.tsx),VUE 用 Tabler 图标(checkbox-group-with-custom-indicator.vue)。同上图标差异。 - [API] `value` 默认值:UP 文档写 `-`((forms)/checkbox.mdx L217),实际原生/RAC 默认 `'on'`;VUE 明确 `'on'`(checkbox.md L223)——UP 文档与自身代码不一致,VUE 更准确。 - [API] `validate` 返回类型:UP `ValidationError | true | null | undefined`(checkbox.mdx L213),VUE `string | string[] | true | null | undefined`(checkbox.md L229);ValidationError 对象结构在 VUE 不支持(VUE 文档自述"暂不提供完整 validationDetails")。 - [文档] 组件结构示例:UP 含 ` {/* 可选 — 校验消息 */}`(checkbox.mdx L37),VUE 结构示例无 FieldError(checkbox.md L44-52)。Hover 归属描述不同:UP"Checkbox.Control(按钮)上的 :hover"(checkbox.mdx L193),VUE"CheckboxContent(可点击标签)上的 :hover"(checkbox.md L206)。 - [样式] motion-reduce 写法:UP `@apply motion-reduce:transition-none`(heroui/packages/styles/components/checkbox.css L78、L91)→ VUE 原生 `@media (prefers-reduced-motion: reduce){transition:none}`(heroui-vue/packages/styles/components/checkbox.css L84-86、L99-101)。语义等价(VUE 注释:Tailwind 4 嵌套伪变体可产出非法 `:not(:is())`),仅写法差异。cursor 规则逐条核对一致(.checkbox/.checkbox__control `cursor:var(--cursor-interactive)`、`.checkbox__content[data-slot="label"]` 同值、description/field-error `cursor-default`),未见差异。 ### checkbox-group - [示例] checkbox-group-validation:UP `alert(\`已选偏好:${values.join(", ")}\`)`(checkbox-group/validation.tsx L10-18),VUE 行内 `

`(checkbox-group-validation.vue);结构/文案/props 一致。 - [示例] checkbox-group-features-and-addons:VUE `

` 类多 `max-sm:min-w-0`(checkbox-group-features-and-addons.vue L34;UP features-and-addons.tsx L26 无),响应式行为差异(小);图标 gravity-ui Envelope/Comment/Bell → Tabler IconMail/IconMessage/IconBell。Content/Control 类经复核完全一致(demo_classes 的 clsx 拆分误报)。 - [API] `defaultValue` 默认值:UP `-`((forms)/checkbox-group.mdx L137),VUE `[]`(checkbox-group.md L153);UP 文档与 RAC 实际(空数组)不一致。 - [API] UP 表格缺 `validate`/`validationBehavior`(RAC CheckboxGroup 自身支持),VUE 提供(checkbox-group.md L159-160);VUE 另增 `form`/`id`。 - [文档] 结构示例:UP 有组级 `` 与 `name="interests"`(checkbox-group.mdx L28-41),VUE 缺组级 Description 与 name(checkbox-group.md L46-58)。 - [样式] checkbox-group.css 仅许可头差异;tv 映射一致(heroui/packages/styles/src/components/checkbox-group/checkbox-group.styles.ts ↔ heroui-vue/packages/styles/src/index.ts L602-615)。 ### radio-group - [示例] radio-group-validation:结果提示缺类名——UP `

`(radio-group/validation.tsx 末行),VUE `

`(radio-group-validation.vue),少 `text-muted`(可见视觉差异,小)。 - [示例] radio-group-custom-indicator:选中指示器内容不同——UP `✓`(radio-group/custom-indicator.tsx L15-19 等),VUE Tabler `IconCheck class="size-3 text-background"`(radio-group-custom-indicator.vue)。"✓"文本字形 vs 图标、尺寸类不同。 - [API] UP 表格缺 `validate`/`validationBehavior`/`dir`/`loop`(RAC 支持),VUE 提供(radio-group.md L214-219)。 - [文档] VUE 自身错误:RadioGroup `variant` 行误写"Checkbox 成员可显式覆盖"(radio-group.md L210);"事件与暴露"表沿用 CheckboxGroup 文案"发出新的数组或标量"(L237,RadioGroup 仅标量);L240 提交说明段以"CheckboxGroup 按原生约定…"开头(复用文本)。 - [文档] UP 有 `## 相关案例 `((forms)/radio-group.mdx L249-251),VUE 无此章节。 - [样式] radio.css/radio-group.css:motion-reduce 同 checkbox 的原生 media 重写(radio.css L55-57、L71-73、L140-142),语义等价;其余仅换行。tv 一致。 ### switch - [示例] switch-form:UP `alert(\`表单提交内容:\n…\`)`(switch/form.tsx L10-16);VUE 行内 ``,并新增"重置"按钮(`type="reset"` + `@click="result = ''"`)、空态文案"未选择任何选项"、分隔符由 `\n` 改为","(switch-form.vue)。 - [示例] switch-with-icons:aria-label 不同——UP `aria-label={key}`("check"/"darkMode"/"microphone"/"notification"/"volume" 英文 key,switch/with-icons.tsx L45),VUE 中文标签"电源/深色模式/静音麦克风/通知/静音音量"(switch-with-icons.vue);容器 `flex gap-3`→`flex flex-wrap gap-3`;图标 gravity-ui→Tabler;opacity-100/70 改为动态 class(渲染等价)。 - [API] UP SwitchFieldRenderProps 含 `state: ToggleState`((controls)/switch.mdx L261),VUE 根作用域插槽仅 isSelected/isDisabled/isReadOnly/isInvalid/isRequired,无 `state`(switch.md L145)。 - [API] `onPress(PressEvent)`(switch.mdx L238)VUE 无对应事件(简报忽略项含 onPress→@click,简注;VUE 在"当前差异"自述 PressEvent 不等价,switch.md L175)。 - [文档] 组件结构:UP 含 `Switch.Icon` 可选件、`Label/Description` 于 Content 内,以及独立的 SwitchGroup 分组结构代码块(switch.mdx L25-64);VUE 结构示例仅单个 Switch,缺 SwitchGroup 结构片段(switch.md L29-37)。 - [文档] 样式参考大幅缺章:UP 有 Switch 类清单 8 项(含 `--sm/--md/--lg`)+ SwitchGroup 类清单 4 项 + 交互状态列表(switch.mdx L185-217);VUE 压缩为一段散文(switch.md L117),SwitchGroup 类与交互状态章节缺失。 - [文档] 全局 CSS 示例内容不同:UP 覆盖 `.switch/.switch__control/.switch__thumb/.switch__content/.switch__icon`(switch.mdx L157-178);VUE 仅 `.hv-switch__control { border-radius: 12px; }`(switch.md L107-113)。 - [样式] switch.css 逐条核对仅换行差异,规则/数值/运动降级均一致;switchVariants tv 一致(up switch.styles.ts ↔ vue styles/src/index.ts L94-120)。 ### slider - [示例] slider-range:VUE 为每个 Thumb 增加 `:aria-label="index === 0 ? '最低价格' : '最高价格'"`(slider-range.vue),UP 无(slider/range.tsx)。 - [示例] slider-custom-output:VUE 同样增加"区间下限/区间上限" aria-label(slider-custom-output.vue),UP 无(slider/custom-output.tsx)。 - [API] `defaultValue` 默认值:UP 文档 `-`((controls)/slider.mdx L184),VUE `0`(slider.md L156)。 - [API] RenderProps 的 `state: SliderState`(slider.mdx L235)在 VUE 根/Track 作用域插槽中缺失(slider.md L180-186、L203 只有 value/values/isDisabled/orientation/getThumbValueLabel)。 - [API] VUE 新增 `locale`/`dir`/`as`/`id`、Thumb `form`/`id`(slider.md L161-167、L214-215,能力增强)。 - [文档] "全局 CSS"示例内容不同:UP 用 `.slider-track/.slider-fill/.slider-thumb`(与其实际 BEM `.slider__track` 等命名不一致)及另一套属性(slider.mdx L121-143);VUE 用 `.hv-slider__track{bg-default}` 等(slider.md L107-125)。 - [文档] UP `## 无障碍` 章节(含 React Aria 链接,slider.mdx L241-253)对应 VUE `## 可访问性与表单`+实现差异说明(slider.md L227-235),内容重写非翻译(大体等价,简注)。 - [样式] VUE 新增 `.slider__thumb:has(.slider__input:focus-visible){ z-10 status-focused }`(heroui-vue/packages/styles/components/slider.css L182);UP 仅 `&[data-focus-visible="true"]`(heroui/.../slider.css L68)。VUE Thumb 也会输出 `data-focus-visible`(SliderThumb.vue L156),该规则为兜底,未见可见差异(简注)。 - [样式/动画] motion-reduce 重写:UP `@apply motion-reduce:transition-none`(slider.css L34/L42)与 `motion-reduce:scale-100`(L48)→ VUE 文件末尾 `@media (prefers-reduced-motion: reduce){.slider__thumb,.slider__thumb::after{transition:none} .slider__thumb[data-dragging="true"]::after{scale:1}}`(vue slider.css L185-193)。语义等价。 - [实现] Thumb 内真实 input 从 VisuallyHidden 改为透明覆盖层(`opacity:0; inset:0; z-index:20; cursor:inherit`,SliderThumb.vue L183-200)并显式补 `role="slider"` 与 aria-valuenow/min/max/valuetext;拖动改为轨道局部 pointer capture(slider.md L235 自述 Reka Collection Thumb 缺口)。行为目标一致,复杂指针/多指场景(待核实)。 ### input - [示例] input-on-surface:UP ``,VUE 少 `bg-surface`、另加 `variant="default"`(input-on-surface.vue;UP input/on-surface.tsx)。背景是否由 Surface 变体等价补回(待核实);VUE 另加 `aria-label="你的姓名"`。 - [API] `defaultValue` 默认值:UP `-`((forms)/input.mdx L113),VUE `''`(input.md L80,等价更明确)。 - [API] 原生直通属性归属:UP 表格逐项列 maxLength/minLength/pattern/min/max/step(input.mdx L121-126);VUE 合并为 `maxlength/minlength`、`pattern`、`min/max/step` 行(input.md L86-88),经 `v-bind="{...control.inheritedAttrs(), ...attrs}"` 落在真实 ``(Input.vue L26),归属一致、仅表格呈现不同。VUE 增 `invalid` prop(UP 引导用 TextField 的 isInvalid)。 - [文档] UP ` 校验、标签与错误消息请参阅 TextField`(input.mdx L19-21);VUE 改写为"TextField 尚未迁移,当前请使用原生 label、aria-describedby 和 aria-invalid 关联"(input.md L18-20)——**与事实不符**:TextField 已实现并导出(heroui-vue/packages/vue/src/index.ts L192;apps/docs/components/text-field.md 存在)。 - [文档] 全局 CSS 示例:UP 完整 `.input` 覆盖样例(hover/focus-visible/invalid,input.mdx L62-82);VUE 仅 `border-radius: 8px`(input.md L59-65)。样式参考:UP 有交互状态清单含 `Read Only:[aria-readonly="true"]`(input.mdx L94-100);VUE 一行散文且缺 readonly 状态(input.md L69)。 - [样式] input.css 仅换行差异;inputVariants tv 一致。 ### textarea - [API] 原生直通属性归属:UP 表格逐项列 `rows`(默认3)/`cols`/`wrap`/`maxLength`/`minLength`/`autoComplete`((forms)/text-area.mdx L109-122);VUE 表格仅 rows(默认3)/fullWidth/variant/invalid/class,`cols/wrap/minlength/maxlength/autocomplete` 等以文字声明透传(textarea.md L114),经 TextArea.vue `v-bind="{...attrs}"` 确实透传到真实 `