feat(Switch): 支持 shape 属性(圆角矩形与线性形态) - #4341
Open
xy200303 wants to merge 3 commits into
Open
Conversation
- add shape prop with circle, round and line options, circle by default - line shape renders a slim track and does not render switch content label - related to Tencent/tdesign-common#2563, works with Tencent/tdesign-common#2640
xy200303
requested review from
HaixingOoO,
NWYLZW,
RylanBot,
ZWkang,
carolin913,
honkinglin and
uyarn
as code owners
July 30, 2026 04:24
21 tasks
Collaborator
|
/update-common 2640 |
Collaborator
TDesign Component Site Preview Open
|
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

🤔 这个 PR 的性质是?
🔗 相关 Issue
💡 需求背景和解决方案
Switch 目前只有单一的胶囊形态。本 PR 为 Switch 补充
shapeAPI 的组件实现,配合 tdesign-common#2640 的公共样式,支持 circle(默认胶囊)、round(圆角矩形)和 line(线性)三种形状。最终 API(Switch 新增)
circle/round/linecircleline形态不展示开关内容label用法:
实现说明
t-switch--shape-{shape}类名,与 tdesign-common#2640 的样式选择器对齐line形态下不渲染t-switch__content,符合公共样式中 label 由框架 API 层负责不渲染的语义边界circle形态视觉不变验证
lint:tsc、eslint、csr/ssr 快照测试通过,已补充 shape demo 快照📝 更新日志
☑️ 请求合并前的自查清单