For AI agents: the complete documentation index is available at https://rickyshin93.github.io/tao-ui/zh/llms.txt, the full documentation bundle is available at https://rickyshin93.github.io/tao-ui/zh/llms-full.txt, and this page is available as Markdown at https://rickyshin93.github.io/tao-ui/zh/components/tooltip.md.
v0.0.57
  • 简体中文
  • Tooltip

    数据展示@rockshin/tao-ui

    在悬停或键盘聚焦时展示简短补充说明。

    何时使用

    图标、缩写或控件需要一行辅助解释时使用 Tooltip。

    推荐

    • 内容保持简短。
    • 确保键盘聚焦也能触发。

    避免

    • 关键说明或交互内容不要只放在 Tooltip 中。

    代码演示

    基础用法

    TSX

    弹出位置

    TSX

    箭头、颜色与受控显示

    TSX

    不显示箭头

    arrow=false 去掉指向箭头。

    TSX

    受控提示

    用 open 与 onOpenChange 同步可见状态。

    TSX

    自定义颜色

    color 自定义提示背景,使用时保证文字对比度。

    TSX

    悬停延迟

    延迟以秒为单位,键盘焦点不等待悬停延迟。

    TSX

    条件提示

    title 为空时禁用提示,适合仅在需要解释时显示。

    TSX

    API

    Tooltip

    属性说明类型默认值
    titleTooltip content. Empty strings, booleans, null and undefined disable it.ReactNode-
    placementPopup side relative to the trigger. Defaults to 'top'.TooltipPlacement | undefined-
    arrowShow the arrow pointing at the trigger. Defaults to true.boolean | undefined-
    mouseEnterDelayHover delay in seconds before opening. Defaults to 0.1. Focus opens immediately.number | undefined-
    mouseLeaveDelayDelay in seconds before a pointer-leave closes the tooltip. Defaults to 0.1 (antd parity) — re-entering the trigger or content before the deadline cancels the close. Esc / focus-blur closes stay immediate.number | undefined-
    colorCustom content background color.string | undefined-
    className节点类名string | undefined-
    style节点样式CSSProperties | undefined-
    childrenExactly one trigger element.ReactNode (必填)-