Theme studio

Design a theme, preview it live, then export it. Saved in this browser.

Quick picks #10b981
Generated scale
50100200300400500600700800900
Some text is below AA

Tooltip

  • Stable
  • WCAG 2.2 evidence
  • RTL

A short description of a control, shown on hover and keyboard focus. Built on React Aria Tooltip inside a {@link TooltipTrigger}: role="tooltip", linked to the trigger with aria-describedby while open (WCAG 4.1.2); shown on focus as well as hover (WCAG 2.1.1); dismissible with Escape, hoverable and persistent until the pointer or focus leaves (WCAG 1.4.13). Animation runs only without reduced motion. Consumer duties: the trigger needs its own accessible name (the tooltip is a description, not the name); never put the only copy of essential information in a tooltip.

import { Tooltip } from "@nexera-ui/react";
Loading example…
5
examples
19
props
2
live controls
1
platform
7
WCAG criteria
1
block uses it

Try every prop. Copy the code.

Change the props and the code updates. Check light and dark, LTR and RTL, and phone width.

Loading…
children
placement
Generated code
import { Tooltip } from "@nexera-ui/react";

<Tooltip />

Examples 4

The same examples as Storybook, rendered live. Open Code to copy one.

With shortcut

Figma Show shortcut: the shortcut prop. Set aria-keyshortcuts on the trigger as well.

Loading example…

Placements

Interactive: hover or Tab to each button. The tooltip shows on focus as well as hover, and Escape hides it.

Loading example…

Long content

Long text wraps at 20 rem instead of truncating. Keep tooltips to a short phrase; use Popover for more.

Loading example…

Right to left

Right-to-left: the text reads right to left and the shortcut follows the text; left/right stay physical sides.

Loading example…

Props 19

Press "Try it" on a card to load that prop into the playground.

19 props shown

children*Nexera
ReactNode

Tooltip text, a short phrase such as "Edit employee". It describes the trigger (aria-describedby); never put essential information or interactive content here (use Popover or visible helper text).

Default –
shortcutNexera
string

Keyboard shortcut shown after the text, for example "E". Shown when provided. Also set aria-keyshortcuts on the trigger when the shortcut exists.

Default –
placementNexera
"top" | "bottom" | "left" | "right"

Side of the trigger the tooltip appears on. Flips to the opposite side when there is no room. left and right are physical sides and do not mirror in right-to-left layouts.

Default top
offsetNexera
number

Distance in px between the trigger and the bubble; the 6 px arrow sits in this gap (value UNVERIFIED).

Default 8
classNameNexera
string

Extra classes for the bubble, merged last so they win over the defaults.

Default –
styleNexera
CSSProperties

Inline style for the bubble.

Default –
arrowBoundaryOffsetReact Aria
number

The minimum distance the arrow's edge should be from the edge of the overlay element.

Default 0
triggerRefReact Aria
RefObject<Element | null>

The ref for the element which the tooltip positions itself with respect to. When used within a TooltipTrigger this is set automatically. It is only required when used standalone.

Default –
isEnteringReact Aria
boolean

Whether the tooltip is currently performing an entry animation.

Default –
isExitingReact Aria
boolean

Whether the tooltip is currently performing an exit animation.

Default –
containerPaddingReact Aria
number

The placement padding that should be applied between the element and its surrounding container.

Default 12
crossOffsetReact Aria
number

The additional offset applied along the cross axis between the element and its anchor element.

Default 0
shouldFlipReact Aria
boolean

Whether the element should flip its orientation (e.g. top to bottom or left to right) when there is insufficient room for it to render completely.

Default true
isOpenReact Aria
boolean

Whether the element is rendered.

Default –
defaultOpenReact Aria
boolean

Whether the overlay is open by default (uncontrolled).

Default –
onOpenChangeReact Aria
(isOpen: boolean) => void

Handler that is called when the overlay's open state changes.

Default –
aria-labelReact Aria
string

Defines a string value that labels the current element.

Default –
aria-labelledbyReact Aria
string

Identifies the element (or elements) that labels the current element.

Default –
aria-describedbyReact Aria
string

Identifies the element (or elements) that describes the object.

Default –

* Required. React Aria props shown are the ones most apps use; the component accepts the rest of its React Aria props too.

Accessible by default.

Built on React Aria, and covered by the WCAG 2.2 evidence generated on every build.

WCAG 2.2 evidence

4 direct · 3 supporting
  • 1.3.1Info and RelationshipsLevel A · tested directly
  • 1.3.2Meaningful SequenceLevel A · supporting test
  • 1.4.12Text SpacingLevel AA · supporting test
  • 1.4.13Content on Hover or FocusLevel AA · tested directly
  • 2.1.1KeyboardLevel A · tested directly
  • 2.3.3Animation from InteractionsLevel AAA · supporting test
  • 4.1.2Name, Role, ValueLevel A · tested directly

Fits any width.

Nexera components respond to the space they are given. Drag the corner of the frame, or pick a width.

0 px · drag the corner

Styling hooks

Pass className to add Tailwind classes (merged last). State is exposed as data attributes, so you can style it with variants like data-pressed:.

Usage
<Tooltip className="shadow-sm" />

Used in blocks

Related components