Skip to content
Redpanda UI
Esc
↑↓navigate↵open⌘Jpreview
Made by imskyleen
Edit on GitHub

Tooltip

A popup that appears when an element is hovered or focused, showing a hint for sighted users.

Installation

bash
npx shadcn@latest add @redpanda/tooltip
bash
pnpm dlx shadcn@latest add @redpanda/tooltip
bash
yarn dlx shadcn@latest add @redpanda/tooltip
bash
bunx shadcn@latest add @redpanda/tooltip
bash
nubx shadcn@latest add @redpanda/tooltip
bash
aube dlx shadcn@latest add @redpanda/tooltip

Positioning

When to use

Tooltips are supplementary visual labels for controls that already have an independent purpose and accessible name. They are not a way to deliver instructions to touch or screen reader users.

If an information icon exists to open its own popup, use Popover with a named title and description. openOnHover on PopoverTrigger can retain optional hover access while native activation works with keyboard and touch. Keep essential field instructions visible and associate them with the input using aria-describedby.

See the Base UI usage guidelines and infotip guidance.

Usage

tsx
<TooltipProvider>  <Tooltip>    <TooltipTrigger render={<Button type="submit">Save</Button>} />    <TooltipContent>Save</TooltipContent>  </Tooltip></TooltipProvider>

Props

Props

TooltipContent

PropType
arrow?boolean

Whether to show the arrow.

Typeboolean
Defaulttrue

Keyboard interactions

Key Action
Tab to TooltipTrigger Opens the tooltip (keyboard-focus trigger).
Shift+Tab off the trigger Closes the tooltip.
Escape Closes the tooltip without moving focus.
Mouse hover / blur Opens after delayDuration, closes immediately on leave.

Accessibility

  • Tooltips are visual-only hints. They do not provide aria-describedby or replace the trigger’s accessible name. Give icon controls an aria-label that closely matches the visible hint.
  • Use a native interactive trigger through render. Keep its original action and keyboard behavior; do not add a focusable wrapper solely to expose a disabled control’s reason. Put important reasons in associated visible text.
  • Use Popover, not Tooltip, when opening information is the trigger’s purpose. Give the popover a PopoverTitle and PopoverDescription; native activation must work without hover.
  • Wrap multiple tooltips in a single TooltipProvider — Base UI shares a delay / timeout pool so rapid-hover tooltips don’t re-fire the delay.

Controlled vs uncontrolled

Uncontrolled — typical case:

tsx
<Tooltip>  <TooltipTrigger render={<Button type="submit">Save</Button>} />  <TooltipContent>Save</TooltipContent></Tooltip>

Controlled — coordinate the visibility of a visual hint; this does not announce new information to assistive technology:

tsx
const [open, setOpen] = useState(true);
<Tooltip open={open} onOpenChange={setOpen}>  <TooltipTrigger render={<Button type="submit">Save</Button>} />  <TooltipContent>Save</TooltipContent></Tooltip>;

Credits

  • We use Base UI for the tooltip component.
  • We take our inspiration from Shadcn UI for the tooltip style.

Recent changes

  • patchv1.2.0Pin shipped dependency floors to the version we develop against. Registry items now declare ranges like `^5.1.9` (the actual installed version) instead of collapsing to `^5.0.0`, so consumers start on the known-tested baseline while caret semantics still allow any compatible release within the same major.#133
  • minorv1.1.0Theme docs refresh, readability pass on semantic foregrounds, and consumer-facing Base UI regression fixes.#121
  • minorv1.0.0Post-Base-UI polish. Public API unchanged.#116
  • majorv1.0.0Migrate every Radix-based primitive to `@base-ui/react@^1.4.0` (Base UI).#114
  • minorv0.3.0Add theme-provider component to the registry with documentation and tests. Includes playground type improvements (export RegistryItem, remove as-const boilerplate) and docs site dark mode border color fix.#109
See full history →

Last updated on

Was this page helpful?