style(Switch): support round and line shapes#2604
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds new Switch visual “shape” variants (round, line) to the common Web styles and exposes a corresponding “Different Shapes” example entry in the Switch API docs, aligning with upstream component libraries’ new shape API.
Changes:
- Added Switch shape-related design tokens (Less variables) for
roundandline. - Implemented
.t-switch--shape-roundand.t-switch--shape-linestyling, including size variants forline. - Extended Switch API docs (ZH/EN) with a “Different Shapes” section and
{{ shape }}example placeholder.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| style/web/components/switch/_var.less | Adds design tokens for round/line shapes (widths, radii, track/handle sizing). |
| style/web/components/switch/_index.less | Adds concrete CSS rules for --shape-round and --shape-line (including size L/S variants). |
| docs/web/api/switch.md | Adds “不同形状的开关” section and {{ shape }} placeholder. |
| docs/web/api/switch.en-US.md | Adds “Switches of Different Shapes” section and {{ shape }} placeholder. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
另外有一个问题可能需要指导一下: 目前的 Line 样式的开关的滑块 Thumb 的无障碍上的对比度问题,原先在 可以见 https://www.figma.com/design/r9jPY6A4EUDvEdoWQ1LVxe/TDesign-for-web--Community----Select?node-id=45757-378235&t=5X597ofKeSefwy0q-1 的设计稿,也可以在各个组件库的 PR 中查看效果(比如 Tencent/tdesign-vue-next#6776 ) 所以需要更强的阴影。但是如果从 |
|
另外,原 issue 有用户评论:#2563 (comment)
本次我没有实现,需要评估一下是否需要实现,如有需要,我这边同步跟进 |
|


fix #2563
🤔 这个 PR 的性质是?
🔗 相关 Issue
Related issue: #2563
💡 需求背景和解决方案
为 Switch 增加多形态外观支持,配合组件库侧新增的
shapeAPI:circle:默认胶囊形态,继续沿用当前基础样式,不改变既有视觉。round:圆角矩形形态。line:线性形态。相关 PR:
设计稿:https://www.figma.com/design/r9jPY6A4EUDvEdoWQ1LVxe/TDesign-for-web--Community----Select?node-id=45757-378235&t=5X597ofKeSefwy0q-1
📝 更新日志
feat(Switch): 新增 Web Switch
round和line形态样式本条 PR 不需要纳入 Changelog
☑️ 请求合并前的自查清单