Components / Overlays
Tooltip
Short hint on hover and keyboard focus. Not for anything the user must read: it is hidden on touch.
import { Tooltip } from "@stylhero/ui";
Example
Code
import { IconButton, Tooltip, InfoIcon } from "@stylhero/ui";
function TooltipExample() {
return (
<Tooltip content="Prices update every hour">
<IconButton label="About prices" variant="secondary"><InfoIcon /></IconButton>
</Tooltip>
);
}
Props
| Prop | Type | Default | Description |
|---|---|---|---|
children required |
ReactElement |
- | One focusable element, e.g. an IconButton. |
content required |
ReactNode |
- | |
className |
string |
- | |
delay |
number |
300 |
ms before showing on hover. |
placement |
Placement |
"top" |
Keyboard
| Key | Does |
|---|---|
| Focus | Shows it, like hovering |
| Esc | Hides it |
Accessibility
- Has
role="tooltip"and describes its trigger. Use it for extra information only: touch screens can't hover.
Generated from src/components/Tooltip.tsx. Something wrong or missing? Open an issue.