Documentation

Tooltip

A short label shown on hover and on keyboard focus, next to its trigger.

WebStableOverlays

Web only — React, from @krizaka/ui/tooltip. Stable: its API only changes in a major version.

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

  • For information people need to complete a task: put it in the page.Use instead: Field
  • For interactive content (links, buttons).Use instead: Popover
  • On touch screens as the only label: there is no hover.

Installation

Install

npm install @krizaka/ui@beta @krizaka/tailwind@beta @krizaka/tokens@beta tailwindcss

Styles

@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

PropTypeDefaultDescription
childrenrequiredReactNode—The trigger, rendered as is (asChild): a focusable element.
contentrequiredReactNode—What the tooltip says — passed translated.
containerHTMLElement | null—The element the portal renders into (default: document.body).
defaultOpenboolean—Open at first, uncontrolled.
delayDurationnumber300Hover delay in ms before it opens (300 by default).
onOpenChange((open: boolean) => void)—Called when it opens or closes.
openboolean—Open or closed (controlled), with onOpenChange.

Accessibility

  • Radix Tooltip: role="tooltip", linked to the trigger by aria-describedby.
  • It opens on hover after delayDuration (300 ms) and never holds focus.

Keyboard

KeysAction
TabFocusing the trigger shows the tooltip at once.
EscHides it.

Best practices

  • A few words, no punctuation: “Copy the link”.
  • The trigger keeps its own accessible name (an IconButton label); the tooltip repeats it for the eye.

Generated from the code of @krizaka/ui 2.0.0-beta.6: its meta.ts, its examples and its types.Edit this documentation on GitHub

On this page