feat(button): Support better customization with semantic classNames/styles as function#54813
feat(button): Support better customization with semantic classNames/styles as function#54813zombieJ merged 34 commits intoant-design:nextfrom meet-student:button
Conversation
|
|
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
👁 Visual Regression Report for PR #54813 Failed ❌
Warning There are more diffs not shown in the table. Please check the Full Report for details. Important There are 12 diffs found in this PR: 🔄
|
There was a problem hiding this comment.
Summary of Changes
Hello @meet-student, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request significantly enhances the customization capabilities of the Button component by introducing a new prop that allows for dynamic application of styles and class names based on the component's properties. This change aims to provide greater flexibility for design systems and specific styling requirements, making the Button component more adaptable without altering its core behavior.
Highlights
- Enhanced Button Customization: Introduced a new
rulesSemanticsprop to the Button component, allowing developers to define conditional class names and styles based on the button's current props. This provides a powerful mechanism for highly flexible and dynamic styling. - New Utility Hooks: Added
useMergeRulesSemantics,useMergeRulesClassNames, anduseMergeRulesStyleshooks undercomponents/_util/hooks. These hooks facilitate the merging of class names and styles based on predefined rules and component properties. - Documentation and Demo Updates: Refactored the Button component's semantic demo structure, renaming the existing demo and adding a new
semantic/rules.tsxdemo to showcase therulesSemanticsprop. The Dumi theme was also updated to include a toggle for viewing basic vs. rules-based semantic examples. Documentation files (index.en-US.md,index.zh-CN.md) were updated to reflect the new prop and demo structure. - Comprehensive Testing: Included a new test file (
useMergeRulesSemantics.test.tsx) to ensure the correct functionality and merging logic of the newly introduced semantic rules hooks, covering various scenarios including nested class names and style merging.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
This pull request introduces a new rulesSemantics prop for the Button component, allowing for more advanced, rule-based customization of styles and class names. The implementation includes new utility hooks (useMergeRulesSemantics, useMergeRulesClassNames, useMergeRulesStyles) with corresponding tests, and updates to the documentation to demonstrate the new feature. The overall approach is solid, but I've identified some issues with the TypeScript type definitions for nested class names that should be addressed to ensure type safety and improve the developer experience. My review includes suggestions to correct these types.
2025-08-29.21.57.42.mov |
More templates
commit: |
Bundle ReportChanges will increase total bundle size by 7.84MB (209.32%) ⬆️
Affected Assets, Files, and Routes:view changes for bundle: antd.min-array-pushAssets Changed:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## next #54813 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 792 792
Lines 14566 14575 +9
Branches 3875 3876 +1
=========================================
+ Hits 14566 14575 +9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: afc163 <[email protected]> Signed-off-by: 遇见同学 <[email protected]>
Signed-off-by: 遇见同学 <[email protected]>
Signed-off-by: 遇见同学 <[email protected]>
Signed-off-by: 遇见同学 <[email protected]>

























中文版模板 / Chinese template
🤔 This is a ...
🔗 Related
💡 Background and Solution
📝 Change Log