Skip to content

feat(Tooltip): add maxWidth token#56540

Merged
afc163 merged 2 commits intoant-design:featurefrom
guoyunhe:tooltip-max-width
Jan 12, 2026
Merged

feat(Tooltip): add maxWidth token#56540
afc163 merged 2 commits intoant-design:featurefrom
guoyunhe:tooltip-max-width

Conversation

@guoyunhe
Copy link
Contributor

@guoyunhe guoyunhe commented Jan 9, 2026

中文版模板 / Chinese template

🤔 This is a ...

  • 🆕 New feature
  • 🐞 Bug fix
  • 📝 Site / documentation improvement
  • 📽️ Demo improvement
  • 💄 Component style improvement
  • 🤖 TypeScript definition improvement
  • 📦 Bundle size optimization
  • ⚡️ Performance optimization
  • ⭐️ Feature enhancement
  • 🌐 Internationalization
  • 🛠 Refactoring
  • 🎨 Code style optimization
  • ✅ Test Case
  • 🔀 Branch merge
  • ⏩ Workflow
  • ⌨️ Accessibility improvement
  • ❓ Other (about what?)

🔗 Related Issues

  • Describe the source of related requirements, such as links to relevant issue discussions.
  • For example: close #xxxx, fix #xxxx

💡 Background and Solution

📝 Change Log

Language Changelog
🇺🇸 English feat(Tooltip): add maxWidth token
🇨🇳 Chinese feat(Tooltip): 增加 maxWidth token

@bolt-new-by-stackblitz
Copy link

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 9, 2026

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.

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 and usage tips.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2026

👁 Visual Regression Report for PR #56540 Failed ❌

🎯 Target branch: feature (64f7963)
📖 View Full Report ↗︎
📖 Alternative Report ↗︎
📊 Summary: 🔄 2 changed

Expected (Branch feature) Actual (Current PR) Diff
table-sticky.dark.png table-sticky.dark.png table-sticky.dark.png table-sticky.dark.png
table-sticky.default.png table-sticky.default.png table-sticky.default.png table-sticky.default.png

Important

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

  • Visual diff is acceptable

@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2026

Preview is ready

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @guoyunhe, 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 enhances the Tooltip component by introducing a new maxWidth token. This change provides greater flexibility for users to control the visual presentation of tooltips, preventing them from becoming excessively wide and improving overall UI responsiveness and readability. It allows for better adaptation to various content lengths and design requirements.

Highlights

  • New maxWidth token for Tooltip: A new maxWidth token has been introduced for the Tooltip component, allowing developers to customize the maximum width of the tooltip content.
  • Default maxWidth value: The default value for the new maxWidth token is set to 250 pixels, maintaining consistency with previous behavior while enabling future customization.
  • Integration into styling system: The maxWidth token is now integrated into the Tooltip's styling generation, ensuring that the component's maximum width can be controlled via the theme system.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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

  1. 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.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new maxWidth token for the Tooltip component, allowing for easier customization of its maximum width. The implementation is clean and follows the project's conventions. However, the change lacks automated tests to verify the new token's functionality. I've added a comment with a suggestion for a test case to ensure the feature is robust and to prevent regressions.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 9, 2026
@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 9, 2026

@codecov
Copy link

codecov bot commented Jan 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (64f7963) to head (d064ffb).
⚠️ Report is 25 commits behind head on feature.

Additional details and impacted files
@@            Coverage Diff            @@
##           feature    #56540   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          807       807           
  Lines        14867     14867           
  Branches      3935      3935           
=========================================
  Hits         14867     14867           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codecov
Copy link

codecov bot commented Jan 9, 2026

Bundle Report

Changes will increase total bundle size by 8.13MB (210.52%) ⬆️⚠️, exceeding the configured threshold of 5%.

Bundle name Size Change
antd.min-array-push 11.99MB 8.13MB (210.52%) ⬆️⚠️

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.js (New) 6.3MB 6.3MB 100.0% 🚀
antd.js (New) 5.69MB 5.69MB 100.0% 🚀
antd-with-locales.min.js (Deleted) -2.12MB 0 bytes -100.0% 🗑️
antd.min.js (Deleted) -1.74MB 0 bytes -100.0% 🗑️

Files in antd-with-locales.js:

  • ./components/tooltip/style/index.ts → Total Size: 5.25kB

Files in antd.js:

  • ./components/tooltip/style/index.ts → Total Size: 5.25kB

Copy link
Member

@afc163 afc163 left a comment

Choose a reason for hiding this comment

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

Copy link
Member

@afc163 afc163 left a comment

Choose a reason for hiding this comment

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

@dosubot dosubot bot removed the lgtm This PR has been approved by a maintainer label Jan 9, 2026
@guoyunhe
Copy link
Contributor Author

guoyunhe commented Jan 9, 2026

默认值可以改成 fit-content 了

developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/fit-content

@afc163 感觉这样就 breaking change 了,不敢搞

@afc163
Copy link
Member

afc163 commented Jan 12, 2026

可以搞,250 是个拍脑袋的数字,fit-content 应该更合理。

@guoyunhe
Copy link
Contributor Author

可以搞,250 是个拍脑袋的数字,fit-content 应该更合理。

@afc163 试了一下用 fit-content 某些 demo 会出现气泡和箭头分离的情况,可能是 JS 的定位算法没考虑到动态宽度?

image

@afc163
Copy link
Member

afc163 commented Jan 12, 2026

估计是,那先不改。

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 12, 2026
@afc163 afc163 merged commit cb309ac into ant-design:feature Jan 12, 2026
38 checks passed
@zombieJ zombieJ mentioned this pull request Jan 13, 2026
17 tasks
QDyanbing pushed a commit to QDyanbing/ant-design that referenced this pull request Jan 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants