-
-
Notifications
You must be signed in to change notification settings - Fork 998
docs: 补充common-props文档说明 #1120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: 补充common-props文档说明 #1120
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. 📝 WalkthroughWalkthrough新增“通用属性”文档(中英双语)。同时将多篇现有文档的 group.order 从 4 调整为 5,影响导航排序。未涉及代码、API 或导出实体变更。 Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ 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 (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @IsDyh01, 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!
此拉取请求旨在完善组件文档,特别是针对prefixCls等通用属性的描述。作者注意到这些属性在代码中存在,但在某些组件(如Bubble)的文档中缺失,而在另一些组件(如Actions)的文档中则有体现。本次提交首先为Welcome组件补充了prefixCls属性的文档。作者还提出了关于通用属性文档链接失效的问题。
Highlights
- 更新Welcome组件文档: 为Welcome组件的英文和中文文档补充了prefixCls属性的描述,使其与代码实现保持一致。
- 提出文档通用属性问题: 作者指出文档中通用属性的跳转链接存在404错误,并询问是应链接到Ant Design的通用属性文档还是新建一个公共属性描述。
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
感谢您的贡献!这是一个很好的文档改进。您在 Welcome 组件的文档中添加了 prefixCls 属性。
为了使文档更加完整,我建议将 Welcome 组件支持的其他几个属性也一并添加进来,比如您在描述中提到的 rootClassName,以及 className、style、variant 和 styles。我在代码中给出了具体的建议。这样可以让 Welcome 组件的文档更加完善,也为后续补全其他组件的文档提供一个好的范例。
关于您提到的通用属性链接404的问题,这需要项目维护者来决定最佳的解决方案。感谢您指出这个问题!
components/welcome/index.en-US.md
Outdated
|
|
||
| | Property | Description | Type | Default | Version | | ||
| | --- | --- | --- | --- | --- | | ||
| | prefixCls | Prefix for style class names | string | - | - | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
很好地补充了 prefixCls 属性!为了让 Welcome 组件的文档更完整,建议将其他缺失的属性如 rootClassName、className、style、variant 和 styles 也一并加上。这样使用者就能了解到所有可用的 props。
| | prefixCls | Prefix for style class names | string | - | - | | |
| | prefixCls | Prefix for style class names | string | - | - | | |
| | rootClassName | The root class name of the component | string | - | - | | |
| | className | Custom class name for the component | string | - | - | | |
| | style | Custom style for the component | React.CSSProperties | - | - | | |
| | variant | The variant of the component | 'filled' \| 'borderless' | 'filled' | - | | |
| | styles | Custom styles for different parts of each prompt item | Partial<Record<'icon' \| 'title' \| 'description' \| 'extra', React.CSSProperties>> | - | - | |
components/welcome/index.zh-CN.md
Outdated
|
|
||
| | 属性 | 说明 | 类型 | 默认值 | 版本 | | ||
| | --- | --- | --- | --- | --- | | ||
| | prefixCls | 样式类名的前缀 | string | - | - | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
做得很好!除了 prefixCls,建议把 rootClassName、className、style、variant 和 styles 这些 Welcome 组件支持但文档中缺失的属性也一起加上,以保持文档的完整性。
| | prefixCls | 样式类名的前缀 | string | - | - | | |
| | prefixCls | 样式类名的前缀 | string | - | - | | |
| | rootClassName | 组件的根类名 | string | - | - | | |
| | className | 自定义组件的类名 | string | - | - | | |
| | style | 自定义组件的样式 | React.CSSProperties | - | - | | |
| | variant | 组件的变体 | 'filled' \| 'borderless' | 'filled' | - | | |
| | styles | 自定义各个提示项不同部分的样式 | Partial<Record<'icon' \| 'title' \| 'description' \| 'extra', React.CSSProperties>> | - | - | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (3)
components/welcome/index.en-US.md (1)
32-32: 为 prefixCls 增补使用建议,保持与全站文案一致建议在描述中明确这是少数场景才需要的定制项,并引导优先使用 ConfigProvider.prefixCls 做全局配置,与其他组件页保持一致。
-| prefixCls | Prefix for style class names | string | - | - | +| prefixCls | Prefix for the component CSS class names (usually unnecessary; prefer ConfigProvider.prefixCls for global configuration) | string | - | - |components/welcome/index.zh-CN.md (2)
35-35: 优化文案:提示优先使用全局配置,统一站内口径与其他组件页保持一致,建议补充“通常无需设置,推荐通过 ConfigProvider.prefixCls 全局配置”的提示,降低误用成本。
-| prefixCls | 样式类名的前缀 | string | - | - | +| prefixCls | 组件样式类名前缀(通常无需设置,推荐通过 ConfigProvider.prefixCls 全局配置) | string | - | - |
35-35: 关于“通用属性”文档的 404:建议统一出站内链接或新建共用页本次仅在 Welcome 中补齐了 prefixCls,但 PR 描述提到“通用属性”页面 404。建议:
- 若站内已有公共属性页,请将“通用属性参考”链接改为正确路径,并在英文文档也补上同样的链接;
- 若暂无,请新建共用页面统一说明 prefixCls、rootClassName 等公共属性,并在各组件页统一引用。
需要的话我可以起草该通用属性文档的骨架与示例条目。
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
components/welcome/index.en-US.md(1 hunks)components/welcome/index.zh-CN.md(1 hunks)
🔇 Additional comments (2)
components/welcome/index.en-US.md (1)
32-32: 新增条目本身没问题新增 prefixCls 的英文条目与现有字段顺序/风格一致,符合预期。
components/welcome/index.zh-CN.md (1)
35-35: 新增条目本身没问题新增 prefixCls 的中文条目位置、格式与其他字段一致。
components/welcome/index.en-US.md
Outdated
|
|
||
| | Property | Description | Type | Default | Version | | ||
| | --- | --- | --- | --- | --- | | ||
| | prefixCls | Prefix for style class names | string | - | - | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
确认类型是否可选,并与中文文档保持一致
多数组件中 prefixCls 为可选属性。请确认 Welcome 的类型定义是否为可选,并同步两端文档(若为可选,Type 一栏建议说明为 string 但在描述中补充“可选”提示,或统一写法为 prefixCls?: string,与站内其他页面保持一致)。
如需快速核对源码中的定义,可运行以下脚本搜索 Welcome 组件的 props 定义与 prefixCls 使用情况:
🏁 Script executed:
#!/bin/bash
# 说明:查找 Welcome 组件 props/类型定义中关于 prefixCls 的声明与可选性
# 期望:在 TS/TSX 源码中看到 WelcomeProps(或同义类型)里 prefixCls 是否带有 ? 可选标记
# 搜索可能的组件实现与类型定义
fd -t f -e ts -e tsx -e d.ts | rg -n -C2 -P '(?i)\bWelcome(?:Props|PropsBase|PropsType)?\b|prefixCls'
# 更聚焦地尝试匹配接口中字段定义
rg -n -C3 -P '(?s)interface\s+Welcome\w*Props\b.*?\{.*?\n.*prefixCls\??\s*:\s*string' --type=ts --type=tsxLength of output: 844
为了进一步确认 Welcome 组件的 prefixCls 在类型定义中是否标记为可选,并查看其在源码中的默认值使用情况,请执行以下脚本:
🏁 Script executed:
#!/bin/bash
# 查找 Welcome 组件 props 的接口或类型定义
rg -n -C3 'interface\s+Welcome\w*Props\b' -g '*.ts' -g '*.tsx'
rg -n -C3 'type\s+Welcome\w*Props\b' -g '*.ts' -g '*.tsx'
# 查看 components/welcome/index.tsx 中对 prefixCls 的声明、默认值或解构
rg -n -C5 'prefixCls' -g 'components/welcome/index.tsx'Length of output: 7258
请同步更新 Welcome 组件文档:将 prefixCls 标记为可选
- 源码(components/welcome/index.tsx)中已定义
export interface WelcomeProps { prefixCls?: string; … }
- 在 components/welcome/index.en-US.md 的参数表(第32行)中:
- 建议在 Description 一栏写成
Prefix for style class names (optional) - 或将 Type 一栏改为
prefixCls?: string并在描述中补充 “optional” 提示
- 建议在 Description 一栏写成
- 在对应的中文文档(components/welcome/index.zh-CN.md)同步加入“可选”说明
🤖 Prompt for AI Agents
In components/welcome/index.en-US.md around line 32, update the props table so
that prefixCls is marked optional—either change the Description to "Prefix for
style class names (optional)" or change the Type cell to "prefixCls?: string"
and add "(optional)" in the Description; also apply the same "optional" note to
components/welcome/index.zh-CN.md at the corresponding prop row to keep docs in
sync with the source interface in components/welcome/index.tsx where prefixCls
is defined as optional.
components/welcome/index.zh-CN.md
Outdated
|
|
||
| | 属性 | 说明 | 类型 | 默认值 | 版本 | | ||
| | --- | --- | --- | --- | --- | | ||
| | prefixCls | 样式类名的前缀 | string | - | - | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
核对属性可选性并中英文同步
请确认源码中 prefixCls 是否为可选项。若为可选,建议在描述中显式标注“可选”(或在类型位展示为 prefixCls?: string,取决于站点一致性规则),并与英文文档同步。
为便于核对,可运行以下脚本检查 TS 源码中的声明:
🏁 Script executed:
#!/bin/bash
# 说明:在代码库中查找 Welcome 组件 props 与 prefixCls 字段可选性
fd -t f -e ts -e tsx -e d.ts | rg -n -C2 -P '(?i)\bWelcome(?:Props|PropsBase|PropsType)?\b|prefixCls'
rg -n -C3 -P '(?s)interface\s+Welcome\w*Props\b.*?\{.*?\n.*prefixCls\??\s*:\s*string' --type=ts --type=tsxLength of output: 844
为了进一步确认 prefixCls 在 WelcomeProps 中的可选性,请运行以下脚本:
🏁 Script executed:
#!/bin/bash
# 1. 查找 Welcome 组件 Props 接口定义
rg -n --context 3 'interface\s+Welcome\w*Props\b' components/welcome
# 2. 查找 prefixCls 是否声明为可选属性
rg -n --context 3 'prefixCls\s*\?:\s*string' components/welcomeLength of output: 963
更新文档:明确 prefixCls 为可选属性,并与英文文档保持一致
WelcomeProps 接口中已声明
export interface WelcomeProps {
prefixCls?: string;
…
}说明 prefixCls 为可选项,需在中/英文文档里同步标注。
请在以下位置进行更新:
- 在
components/welcome/index.zh-CN.md中,将该行的“可选性”列由-改为可选,或将“类型”列修改为prefixCls?: string(依据站点统一规范)。 - 同步在
components/welcome/index.en-US.md中做相同调整。
示例 diff(中文文档):
-| prefixCls | 样式类名的前缀 | string | - | - |
+| prefixCls | 样式类名的前缀 | string | 可选 | - |🤖 Prompt for AI Agents
In components/welcome/index.zh-CN.md around line 35 the table entry for
prefixCls currently shows no optionality; update that row to indicate prefixCls
is optional (either change the “可选性” column from “-” to “可选” or change the “类型”
column to `prefixCls?: string` to follow project convention). Also make the same
corresponding edit in components/welcome/index.en-US.md so both docs match the
WelcomeProps interface declaration `prefixCls?: string`.
|
@afc163 是否需要添加文档中缺失的这些组件属性呢 |
Bundle ReportBundle size has no change ✅ |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1120 +/- ##
=======================================
Coverage 92.45% 92.45%
=======================================
Files 69 69
Lines 1577 1577
Branches 410 426 +16
=======================================
Hits 1458 1458
Misses 119 119 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
您好 通用属性我们不在组件的文档内重复写出 后续补充 https://x.ant.design/docs/react/common-props-cn 这个文档 |
|
@kimteayon 嗯嗯好的 我是看有些组件文档是有这些通用属性的 ,我来提交这个文档可以吗? 然后需要删除掉现在重复的组件文档吗 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (4)
docs/react/common-props.zh-CN.md (2)
9-9: 中英混用与品牌名统一:将 “Tips” 改为 “提示”,并使用“Ant Design X”当前为英文“Tips”与“antdx”小写拼写,建议与中文文档与品牌写法保持一致。
-> Tips: 以下通用属性适用于 antdx 大部分组件,不支持的组件会单独说明。 +> 提示:以下通用属性适用于 Ant Design X 大多数组件;不支持的组件会在文档中单独说明。
11-16: 补充一行解释,澄清 className 与 rootClassName 的区别,并提示 prefixCls 配置入口有助于减少使用歧义,亦与社区常见问题对齐。
| rootClassName | 添加在组件最外层的 className | string | - | | prefixCls | 样式类名的前缀 | string | - | + +> 说明: +> - `className` 通常作用于组件的容器元素(内部包装),`rootClassName` 作用于组件的根节点; +> - `prefixCls` 可通过 ConfigProvider 全局配置,个别组件也支持按需覆盖。docs/react/common-props.en-US.md (2)
9-9: Minor copyedit: “Tips” → “Tip”, brand to “Ant Design X”, simplify phrasing提升一致性与可读性。
-> Tips: The following generic properties apply to most antdx components; those not supported are described separately. +> Tip: The following common properties apply to most Ant Design X components; unsupported components will be noted explicitly.
11-16: 术语与大小写优化(CSS/class name),提升准确性
- “css” → “CSS”
- “ClassName” → “Class name”
- “The additional style” 更明确为 “Inline style”
- 对 prefix 说明更贴近组件场景
| Property | Description | Type | Default | | ------------- | ----------------------------- | ------------- | ------- | -| style | The additional style | CSSProperties | - | -| className | The additional css class | string | - | -| rootClassName | ClassName on the root element | string | - | -| prefixCls | Prefix for style class names | string | - | +| style | Inline style | CSSProperties | - | +| className | Additional CSS class | string | - | +| rootClassName | Class name on the root element| string | - | +| prefixCls | Prefix for component CSS class names | string | - |
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (8)
docs/react/common-props.en-US.md(1 hunks)docs/react/common-props.zh-CN.md(1 hunks)docs/react/contributing.en-US.md(1 hunks)docs/react/contributing.zh-CN.md(1 hunks)docs/react/dangerously-api-key.en-US.md(1 hunks)docs/react/dangerously-api-key.zh-CN.md(1 hunks)docs/react/faq.en-US.md(1 hunks)docs/react/faq.zh-CN.md(1 hunks)
✅ Files skipped from review due to trivial changes (6)
- docs/react/dangerously-api-key.zh-CN.md
- docs/react/contributing.en-US.md
- docs/react/dangerously-api-key.en-US.md
- docs/react/contributing.zh-CN.md
- docs/react/faq.zh-CN.md
- docs/react/faq.en-US.md
🧰 Additional context used
🪛 LanguageTool
docs/react/common-props.en-US.md
[grammar] ~9-~9: Ensure spelling is correct
Context: ...lowing generic properties apply to most antdx components; those not supported are des...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
[grammar] ~11-~11: There might be a mistake here.
Context: ... | Type | Default | | ------------- | ----------------------...
(QB_NEW_EN)
[grammar] ~12-~12: There might be a mistake here.
Context: ...------------ | ------------- | ------- | | style | The additional style ...
(QB_NEW_EN)
[grammar] ~13-~13: There might be a mistake here.
Context: ...yle | CSSProperties | - | | className | The additional css cla...
(QB_NEW_EN)
[grammar] ~14-~14: There might be a mistake here.
Context: ...s class | string | - | | rootClassName | ClassName on the root ...
(QB_NEW_EN)
[grammar] ~15-~15: There might be a mistake here.
Context: ...root element | string | - | | prefixCls | Prefix for style class...
(QB_NEW_EN)
docs/react/common-props.zh-CN.md
[grammar] ~11-~11: There might be a mistake here.
Context: ... | 类型 | 默认值 | | ------------- | ----------------------...
(QB_NEW_EN)
[grammar] ~12-~12: There might be a mistake here.
Context: ...------------- | ------------- | ------ | | style | 自定义样式 ...
(QB_NEW_EN)
[grammar] ~13-~13: There might be a mistake here.
Context: ... | CSSProperties | - | | className | 自定义类名 ...
(QB_NEW_EN)
[grammar] ~14-~14: There might be a mistake here.
Context: ... | string | - | | rootClassName | 添加在组件最外层的 className | ...
(QB_NEW_EN)
[grammar] ~15-~15: There might be a mistake here.
Context: ...外层的 className | string | - | | prefixCls | 样式类名的前缀 ...
(QB_NEW_EN)
🔇 Additional comments (4)
docs/react/common-props.zh-CN.md (2)
1-7: 元信息的分组顺序请与站点其余文档保持一致本 PR 其它文档有将 group.order 从 4 调整为 5 的改动;该页仍为 4。为避免导航排序不一致,请确认最终期望值,并与同组文档统一。
如需与其它文档保持一致,可按下述修改(仅在站点统一为 5 时再改):
group: title: 进阶使用 - order: 4 + order: 5
1-16: 整体方向正确,文档新增对齐了讨论结论新增“通用属性”页能够解决组件文档中重复/缺失的说明问题,方向赞同。
docs/react/common-props.en-US.md (2)
1-7: Please align group.order with the site-wide navigation orderOther docs in this PR moved group.order from 4 to 5. This page still uses 4. Confirm the final intended order and keep it consistent across the “Advanced” group.
If the rest are set to 5, update as below:
group: title: Advanced - order: 4 + order: 5
8-16: Addition looks good overallThe new Common Props page consolidates duplicated prop descriptions and matches the CN page. Good direction.
* docs: 补全文档中类似Prefix等属性 * docs: 补充common-props文档

中文版模板 / Chinese template
🤔 This is a ...
我看现在源码中应该都有类似Prefix,rootClassname这些prop,但是文档中有些组件缺少对这些属性的描述(比如Bubble),有些组件又有这些属性的描述(比如Actions),不太确定是否需要给缺少的文档添加上这些描述,所以就先只修改了一个welcome组件。
而且文档中的通用属性这块的跳转也是404,是需要跳转到antd文档中的commonm-prop还是新开一个公共属性的描述呢?

🔗 Related Issues
💡 Background and Solution
📝 Change Log
Summary by CodeRabbit