Documentation

Tooltip

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

WebStableSuperpositions

Web uniquement — React, depuis @krizaka/ui/tooltip. Stable : son API ne change qu’à une version majeure.

Quand l’utiliser

  • To name an icon button for sighted mouse users: copy, share, more.
  • To show a shortcut next to an action.

Quand ne pas l’utiliser

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

Installation

Installer

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

Styles

@import "tailwindcss";
@import "@krizaka/tailwind";
@import "@krizaka/ui/tailwind.css";

Importer

import { Tooltip } from "@krizaka/ui/tooltip";

Exemples

Top

Above its trigger (the default).

Right

side="right".

Props

PropTypeDéfautDescription
childrenrequisReactNode—The trigger, rendered as is (asChild): a focusable element.
contentrequisReactNode—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.

Accessibilité

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

Clavier

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

Bonnes pratiques

  • 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.

Générée depuis le code de @krizaka/ui 2.0.0-beta.6 : son meta.ts, ses exemples et ses types.Modifier cette documentation sur GitHub

Sur cette page