feat(Button): support top-level ConfigProvider variant by QDyanbing · Pull Request #59589 · ant-design/ant-design · GitHub
Skip to content

feat(Button): support top-level ConfigProvider variant - #59589

Open
QDyanbing wants to merge 4 commits into
featurefrom
feat-button-global-variant
Open

QDyanbing wants to merge 4 commits into
featurefrom
feat-button-global-variant

Conversation

@QDyanbing

Copy link
Copy Markdown
Member

English Template / 英文模板

🤔 这个变动的性质是?

  • 🆕 新特性提交
  • 🐞 Bug 修复
  • 📝 站点、文档改进
  • 📽️ 演示代码改进
  • 💄 组件样式/交互改进
  • 🤖 TypeScript 定义更新
  • 📦 包体积优化
  • ⚡️ 性能优化
  • ⭐️ 功能增强
  • 🌐 国际化改进
  • 🛠 重构
  • 🎨 代码风格优化
  • ✅ 测试用例
  • 🔀 分支合并
  • ⏩ 工作流程
  • ⌨️ 无障碍改进
  • ❓ 其他改动(是关于什么的改动?)

🔗 相关 Issue

关联 #59556(本 PR 仅覆盖 Button)。

💡 需求背景和解决方案

Button 目前不会跟随顶层 ConfigProvider.variant。本 PR 接入公共 useVariant,让 Button 继承顶层的 outlined / filled;不支持的值回退到默认的 outlined,组件级和实例级配置继续支持全部六种 Button variant。

保留实例 color + variant、type / danger 和 ghost 的既有解析顺序,配置回退按 Form variant > button.variant > 顶层 variant 处理。单独设置非 solid 的 button.variant 时,现在也会按默认颜色生效;仅设置 button.color 且没有任何 variant 配置时,保持原有默认行为。公共 hook 的旧调用签名和返回类型保持兼容。

验证:相关 4 个 Jest 套件、111 个测试、25 个快照通过;Biome / ESLint 通过。完整类型检查与 feature 基线一致,仅有两条既有 allowClear 测试类型错误。

📝 更新日志

语言 更新描述
🇺🇸 英文 🆕 Button supports inheriting the top-level ConfigProvider variant and applies non-solid component variants without requiring a color.
🇨🇳 中文 🆕 Button 支持继承顶层 ConfigProvider 的 variant 配置,并支持未配置颜色时使用非 solid 的组件级变体。

@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c18a0950-5626-4db0-baf4-19bc77ae0be2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Preview is ready

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

👁 Visual Regression Report for PR #59589 Failed ❌

🎯 Target branch: feature (ffd1a0c)
⚠️ Baseline may be stale: no snapshot for the PR's base commit was found, so an older branch snapshot was used. Some diffs below may come from changes already merged into feature rather than this PR.
📖 View Full Report ↗︎
📖 Alternative Report ↗︎
📊 Summary: 🔄 3 changed

Expected (Branch feature) Actual (Current PR) Diff
form-style-class.compact.png form-style-class.compact.png form-style-class.compact.png form-style-class.compact.png
form-style-class.dark.png form-style-class.dark.png form-style-class.dark.png form-style-class.dark.png
form-style-class.default.png form-style-class.default.png form-style-class.default.png form-style-class.default.png

Important

There are 3 diffs found in this PR: 🔄 3 changed.
Please check all items:

  • Visual diff is acceptable
📖 中文报告

👁 PR #59589 视觉回归报告 失败 ❌

🎯 目标分支: feature (ffd1a0c)
⚠️ 基线可能已过期: 未找到该 PR 基准提交对应的快照,因此回退使用了较旧的分支快照。下方部分差异可能来自已合并到 feature 的改动,而非本 PR。
📖 View Full Report ↗︎
📖 Alternative Report ↗︎
📊 概览: 🔄 3 变更

期望 (分支 feature) 实际 (当前 PR) 差异
form-style-class.compact.png form-style-class.compact.png form-style-class.compact.png form-style-class.compact.png
form-style-class.dark.png form-style-class.dark.png form-style-class.dark.png form-style-class.dark.png
form-style-class.default.png form-style-class.default.png form-style-class.default.png form-style-class.default.png

[!NOTE]
本 PR 共发现 3 处差异:🔄 3 变更。请在上方英文报告中勾选确认项以通过 CI 校验。

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
dist/antd.min.js 446.98 KB (-216 B 🔽)
dist/antd-with-locales.min.js 538.85 KB (-217 B 🔽)

@pkg-pr-new

pkg-pr-new Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

@codecov

codecov Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 230 bytes (0.01%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
antd.min-array-push 3.28MB 230 bytes (0.01%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: antd.min-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
antd-with-locales.min.js 115 bytes 1.84MB 0.01%
antd.min.js 115 bytes 1.44MB 0.01%

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Deploying ant-design with  Cloudflare Pages  Cloudflare Pages

Latest commit: b79ac58
Status: ✅  Deploy successful!
Preview URL: https://38ac6e23.ant-design.pages.dev
Branch Preview URL: https://feat-button-global-variant.ant-design.pages.dev

View logs

@codecov

codecov Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

This branch has not been deployed

No deployments
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.

1 participant