Tooltip
用于纯图标控件的悬停和聚焦工具提示,可位于任意一侧,可选带箭头。
可用框架
Angular: 可用 Vue: 可用 React: 可用 React Native: 可用
用法
<div class="demo-stack">
<div class="demo-row">
<button soneBtn variant="ghost" size="icon" type="button" aria-label="New note" soneTooltip="New note (⌘N)">
<sone-icon icon="note-add" />
</button>
<button soneBtn variant="ghost" size="icon" type="button" aria-label="Search" soneTooltip="Search">
<sone-icon icon="search" />
</button>
<button soneBtn variant="ghost" size="icon" type="button" aria-label="Move to trash" soneTooltip="Move to trash">
<sone-icon icon="trash" />
</button>
</div>
<div class="demo-row">
<button soneBtn variant="outline" size="sm" type="button" soneTooltip="Opens above" soneTooltipSide="top">Top</button>
<button soneBtn variant="outline" size="sm" type="button" soneTooltip="Opens to the right" soneTooltipSide="right">Right</button>
<button soneBtn variant="outline" size="sm" type="button" soneTooltip="Opens below (default)">Bottom</button>
<button soneBtn variant="outline" size="sm" type="button" soneTooltip="Opens to the left" soneTooltipSide="left">Left</button>
<button soneBtn variant="outline" size="sm" type="button" soneTooltip="Shown instantly, no arrow"
[soneTooltipShowDelay]="0" [soneTooltipArrow]="false">No delay</button>
</div>
</div>导入
import {
SoneTooltipDirective,
} from "@surface-one/angular/tooltip";API 参考
SoneTooltipDirective指令
Replaces the host's native `title` rather than sitting beside it — both at once would show two tooltips. The bubble is `aria-hidden`; the control keeps naming itself as it already did, or a screen reader would announce the name twice.
| 名称 | 类型 | 默认值 |
|---|---|---|
soneTooltip | string | "" |
soneTooltipSide`null`: the side its container asks for (`SONE_TOOLTIP_SIDE`), else `bottom`. | TooltipSide | null | null |
soneTooltipAlign | TooltipAlign | "center" |
soneTooltipArrow | boolean | true |
soneTooltipDisabled | boolean | false |
soneTooltipShowDelay | — | SHOW_DELAY_MS |