Skip to content

feat(Switch): support shape prop#3855

Open
Seeridia wants to merge 2 commits into
Tencent:developfrom
Seeridia:feat/switch-shape
Open

feat(Switch): support shape prop#3855
Seeridia wants to merge 2 commits into
Tencent:developfrom
Seeridia:feat/switch-shape

Conversation

@Seeridia

@Seeridia Seeridia commented Jul 2, 2026

Copy link
Copy Markdown

犀牛鸟 Issue,关联 Issue: Tencent/tdesign-common/issues/2563

🤔 这个 PR 的性质是?

  • 日常 bug 修复
  • 新特性提交
  • 文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • CI/CD 改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他

🔗 相关 Issue

Related issue: Tencent/tdesign-common#2563

💡 需求背景和解决方案

为 Switch 增加多形态外观支持,配合组件库侧新增的 shape API:

  • circle:默认胶囊形态。
  • round:圆角矩形形态,样式由 tdesign-common 提供。
  • line:线性形态,样式由 tdesign-common 提供。

相关 PR:

  1. tdesign-api:feat(Switch): add shape api for web TDesignOteam/tdesign-api#914
  2. tdesign-common:style(Switch): support round and line shapes tdesign-common#2604
  3. tdesign-vue-next:feat(Switch): support shape prop tdesign-vue-next#6776
  4. tdesign-react:feat(Switch): support shape prop tdesign-react#4320
  5. Tdsign-vue:feat(Switch): support shape prop #3855

设计稿:https://www.figma.com/design/r9jPY6A4EUDvEdoWQ1LVxe/TDesign-for-web--Community----Select?node-id=45757-378235&t=5X597ofKeSefwy0q-1

image

📝 更新日志

  • feat(Switch): 新增 Web Switch roundline 形态样式

  • 本条 PR 不需要纳入 Changelog

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • Changelog 已提供或无须提供

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new shape prop to the Switch component to support multiple visual shapes (circle, round, line), including rendering behavior changes for line (no label/content), plus documentation and demos to expose the new API.

Changes:

  • Added shape to Switch TS types, runtime props (with default/validator), and usage metadata.
  • Updated Switch rendering to apply a shape modifier class and to skip rendering label/content when shape="line".
  • Updated CN/EN docs and added both Options API and Composition API demos for shape variants.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/switch/type.ts Adds shape to TdSwitchProps TS interface.
src/switch/switch.tsx Applies shape modifier class and adjusts rendering to hide content for line.
src/switch/switch.md Documents the new shape prop in Chinese docs table.
src/switch/switch.en-US.md Documents the new shape prop in English docs table.
src/switch/props.ts Adds runtime shape prop definition (default + validator).
src/switch/_usage/props.json Adds shape to usage metadata/options for documentation tooling.
src/switch/_example/shape.vue Adds Options API demo for shape variants.
src/switch/_example-composition/shape.vue Adds Composition API demo for shape variants.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/switch/_example/shape.vue
Comment thread src/switch/_example/shape.vue
Comment thread src/switch/_example-composition/shape.vue
Comment thread src/switch/_example-composition/shape.vue Outdated
@Seeridia

Seeridia commented Jul 2, 2026

Copy link
Copy Markdown
Author

shape: 'circle' 在上游 API 变更 TDesignOteam/tdesign-api#914 中定义,后续组件库 PR 会在 common 样式合入后更新 submodule pointer 并跑快照等等

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants