11<div align =" center " >
22 <h1 >@rc-component/tooltip</h1 >
3- <p ><sub >Ant Design 生态的一部分。</sub ></p >
4- <img alt =" Ant Design " height =" 32 " src =" https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg " />
3+ <p ><sub ><img alt =" Ant Design " height =" 14 " src =" https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg " style =" vertical-align : -0.125em ;" /> Ant Design 生态的一部分。</sub ></p >
54 <p >💡 React 文字提示组件,基于 trigger 定位和弹层能力构建。</p >
65
76 <p >
1918
2019## 特性
2120
22- - 支持 hover, focus, click, and controlled visibility through one trigger layer.
23- - 提供 built-in placements, custom alignment, delays, arrows, and popup motion.
24- - 暴露 semantic ` classNames ` and ` styles ` slots for root, arrow, and container nodes.
25- - 保留 accessibility wiring through generated tooltip ids and ` aria-describedby ` .
21+ - 支持悬停、聚焦、单击以及通过一个触发层控制可见性。
22+ - 提供内置放置、自定义对齐、延迟、箭头和弹层动作。
23+ - 为根节点、箭头节点和容器节点引入语义 ` classNames ` 和 ` styles ` 槽。
24+ - 通过生成的工具提示 id 和 ` aria-describedby ` 保留可访问性连接。
2625
2726## 安装
2827
@@ -43,39 +42,39 @@ export default () => (
4342);
4443```
4544
46- Online preview: https://tooltip.react-component.vercel.app/
45+ 在线预览: https://tooltip.react-component.vercel.app/
4746
4847## API
4948
5049### Tooltip
5150
5251| 名称 | 类型 | 默认值 | 说明 |
5352| --------------------- | ---------------------------------------------------- | ------------------- | ---------------------------------------------------------- |
54- | ` afterVisibleChange ` | ` (visible: boolean) => void ` | - | Called after popup visibility changes. |
55- | ` align ` | AlignType | ` {} ` | Extra popup alignment config. |
56- | ` arrowContent ` | React.ReactNode | - | Custom arrow content. |
57- | ` builtinPlacements ` | TriggerProps[ 'builtinPlacements'] | built in placements | Placement map passed to trigger. |
58- | ` children ` | React.ReactElement | - | Required trigger element. |
59- | ` classNames ` | ` Partial<Record<SemanticName, string>> ` | - | Semantic class names for root, arrow, and container nodes. |
60- | ` defaultVisible ` | boolean | - | Initial uncontrolled visible state. |
61- | ` destroyOnHidden ` | boolean | false | Destroy popup DOM when hidden. |
62- | ` fresh ` | boolean | - | Keep popup content fresh when closed. |
63- | ` getTooltipContainer ` | ` (node: HTMLElement) => HTMLElement ` | - | Resolve popup container. |
64- | ` id ` | string | generated id | Tooltip id used for accessibility. |
65- | ` motion ` | TriggerProps[ 'popupMotion'] | - | Popup motion config. |
66- | ` mouseEnterDelay ` | number | 0 | Delay in seconds before showing on mouse enter. |
67- | ` mouseLeaveDelay ` | number | 0.1 | Delay in seconds before hiding on mouse leave. |
68- | ` onPopupAlign ` | TriggerProps[ 'onPopupAlign'] | - | Called after popup alignment. |
69- | ` onVisibleChange ` | ` (visible: boolean) => void ` | - | Called when visibility changes. |
70- | ` overlay ` | React.ReactNode \| ` () => React.ReactNode ` | - | Tooltip content. |
71- | ` placement ` | string | ` 'right' ` | Popup placement. |
72- | ` prefixCls ` | string | ` 'rc-tooltip' ` | Prefix class name. |
73- | ` showArrow ` | boolean \| ArrowType | true | Whether to show arrow or provide arrow config. |
74- | ` styles ` | ` Partial<Record<SemanticName, React.CSSProperties>> ` | - | Semantic styles for root, arrow, and container nodes. |
75- | ` trigger ` | ActionType \| ActionType[ ] | ` ['hover'] ` | Actions that show the tooltip. |
76- | ` unique ` | TriggerProps[ 'unique'] | - | Experimental unique container reuse config. |
77- | ` visible ` | boolean | - | Controlled visible state. |
78- | ` zIndex ` | number | - | Popup z-index. |
53+ | ` afterVisibleChange ` | ` (visible: boolean) => void ` | - | 弹层窗口可见性更改后调用。 |
54+ | ` align ` | AlignType | ` {} ` | 额外弹层对齐配置。 |
55+ | ` arrowContent ` | React.ReactNode | - | 自定义箭头内容。 |
56+ | ` builtinPlacements ` | TriggerProps[ 'builtinPlacements'] | built in placements | 放置图传递给触发器。 |
57+ | ` children ` | React.ReactElement | - | 所需的触发元素。 |
58+ | ` classNames ` | ` Partial<Record<SemanticName, string>> ` | - | 根节点、箭头节点和容器节点的语义className称。 |
59+ | ` defaultVisible ` | boolean | - | 初始不受控制的可见状态。 |
60+ | ` destroyOnHidden ` | boolean | false | 隐藏时销毁弹层 DOM。 |
61+ | ` fresh ` | boolean | - | 关闭时保持弹层内容新鲜。 |
62+ | ` getTooltipContainer ` | ` (node: HTMLElement) => HTMLElement ` | - | 解决弹层容器。 |
63+ | ` id ` | string | generated id | 用于辅助功能的工具提示 ID。 |
64+ | ` motion ` | TriggerProps[ 'popupMotion'] | - | 弹层运动配置。 |
65+ | ` mouseEnterDelay ` | number | 0 | 在鼠标输入时显示之前的延迟(以秒为单位)。 |
66+ | ` mouseLeaveDelay ` | number | 0.1 | 在鼠标离开隐藏之前延迟几秒钟。 |
67+ | ` onPopupAlign ` | TriggerProps[ 'onPopupAlign'] | - | 弹层对齐后调用。 |
68+ | ` onVisibleChange ` | ` (visible: boolean) => void ` | - | 当可见性发生变化时调用。 |
69+ | ` overlay ` | React.ReactNode \| ` () => React.ReactNode ` | - | 提示内容。 |
70+ | ` placement ` | string | ` 'right' ` | 弹层窗口放置。 |
71+ | ` prefixCls ` | string | ` 'rc-tooltip' ` | 前缀className。 |
72+ | ` showArrow ` | boolean \| ArrowType | true | 是否显示箭头,或提供箭头配置。 |
73+ | ` styles ` | ` Partial<Record<SemanticName, React.CSSProperties>> ` | - | 根节点、箭头节点和容器节点的语义样式。 |
74+ | ` trigger ` | ActionType \| ActionType[ ] | ` ['hover'] ` | 显示提示的触发行为。 |
75+ | ` unique ` | TriggerProps[ 'unique'] | - | 实验性独特的容器重用配置。 |
76+ | ` visible ` | boolean | - | 受控可见状态。 |
77+ | ` zIndex ` | number | - | 弹层 z 索引。 |
7978
8079## 本地开发
8180
@@ -94,8 +93,8 @@ npm run build
9493npm run prepublishOnly
9594```
9695
97- The release flow is handled by ` @rc-component/np ` through the ` rc-np ` command after the package build.
96+ 包构建完成后,发布流程由 ` @rc-component/np ` 通过 ` rc-np ` 命令处理。
9897
9998## 许可证
10099
101- @rc-component/tooltip is released under the [ MIT] ( ./LICENSE ) license.
100+ @rc-component/tooltip 基于 [ MIT] ( ./LICENSE ) 许可证发布。
0 commit comments