Components
Tooltip
A short label shown on hover and on keyboard focus, next to its trigger.
Web only — React, from @krizaka/ui/tooltip. Stable: its API only changes in a major version.
Why it is here. Used by Orochia, Orazaka.
When to use
- To name an icon button for sighted mouse users: copy, share, more.
- To show a shortcut next to an action.
When not to use
Installation
Install
npm install @krizaka/ui @krizaka/tailwind @krizaka/tokens tailwindcssStyles
@import "tailwindcss";
@import "@krizaka/tailwind";
@import "@krizaka/ui/tailwind.css";Import
import { Tooltip } from "@krizaka/ui/tooltip";Examples
Top
Above its trigger (the default).
Right
side="right".
Props
| Prop | Type | Default | Description |
|---|---|---|---|
childrenrequired | ReactNode | — | The trigger, rendered as is (asChild): a focusable element. |
contentrequired | ReactNode | — | What the tooltip says — passed translated. |
container | HTMLElement | null | — | The element the portal renders into (default: document.body). |
defaultOpen | boolean | — | Open at first, uncontrolled. |
delayDuration | number | 300 | Hover delay in ms before it opens (300 by default). |
onOpenChange | ((open: boolean) => void) | — | Called when it opens or closes. |
open | boolean | — | Open or closed (controlled), with onOpenChange. |
Accessibility
- Radix Tooltip:
role="tooltip", linked to the trigger byaria-describedby. - It opens on hover after
delayDuration(300 ms) and never holds focus.
Keyboard
| Keys | Action |
|---|---|
| Tab | Focusing the trigger shows the tooltip at once. |
| Esc | Hides it. |
Best practices
- A few words, no punctuation: “Copy the link”.
- The trigger keeps its own accessible name (an
IconButtonlabel); the tooltip repeats it for the eye.
Related components
Generated from the code of @krizaka/ui 3.8.0: its meta.ts, its examples and its types.Edit this documentation on GitHub