Prepared Docs

Prepared Docs

⌘K

    Loading navigation…

User

  1. Components
  2. Tooltip
  3. API and Development

Tooltip

API and Development

View Source
Submit Issue

Tooltip displays brief, contextual information when users hover over or focus on an element, providing helpful hints without cluttering the interface. It provides a simple, accessible way to display supplementary information that appears on hover or focus. Built on Radix UI's Tooltip component, it ensures consistent tooltip behavior across the interface with automatic positioning, keyboard accessibility, and screen reader support.

Props

Name

Type

Default

Description

title

ReactNode

—

—

align

TooltipAlign

TooltipAlign.Center

—

cornerStyle

ComponentCornerStyle

—

Corner radius treatment for the tooltip surface; defaults from brand package when omitted.

delayDuration

number

200

Delay in milliseconds before the tooltip appears

disabled

boolean

—

—

onOpenChange

((open: boolean) => void)

—

—

open

boolean

—

—

portalSelector

string

—

The selector of the element to render the portal for the tooltip. If not provided, the tooltip will render in the default location (body). Use this to render the tooltip inside a specific container (e.g., ".radix-themes" for theme inheritance).

preventCloseOnClick

boolean

false

Prevents the tooltip from closing when the trigger is clicked. Useful for read-only elements where clicking should have no effect.

side

TooltipSide

TooltipSide.Top

—

wrapTrigger

boolean

false

Wraps children in a span to reliably capture mouse enter/leave events. Primarily needed with preventCloseOnClick when the child may not compose event handler props passed via cloneElement. NOT needed for tooltips on disabled buttons — Radix Tooltip uses pointer events (onPointerMove), which fire on disabled elements.

Storybook

Interactive examples and edge cases for this component are in Storybook.

Default
Top
Right
Bottom
Left
Align Start
Align Center
Align End
With H T M L Content
Disabled
All Background Colors
All Sides
All Alignments
Over Popover
With Tooltip Portal
With Portal Selector
With Radix Themes Portal

Basic Tooltip

Use for simple text hints that appear on hover.

Tooltip Positioning

Control where the tooltip appears relative to its trigger element.

Top Tooltip

Display the tooltip above the trigger element (default).

Right Tooltip

Display the tooltip to the right of the trigger element.

Bottom Tooltip

Display the tooltip below the trigger element.

Left Tooltip

Display the tooltip to the left of the trigger element.

Tooltip Alignment

Control how the tooltip aligns with its trigger element.

Start Alignment

Align the tooltip to the start of the trigger element.

Center Alignment

Align the tooltip to the center of the trigger element (default).

End Alignment

Align the tooltip to the end of the trigger element.

Rich Content Tooltip

Use React nodes for tooltips with formatted content.

Tooltip on Icon Buttons

Add tooltips to icon buttons for clarity.

Tooltip on Text

Provide additional context for text elements.

Truncated Text with Tooltip

Show full text in a tooltip when display text is truncated.

Disabled Tooltip

Conditionally disable tooltips based on application state.

When disabled, the tooltip doesn't appear and only the children are rendered.

Controlled Tooltip

Control tooltip visibility programmatically.

Tooltip with Custom Wrapper

Wrap elements that don't support event handlers.

The tooltip automatically handles event delegation for wrapped elements.

Tooltip on Disabled Elements

Wrap disabled elements to show tooltips explaining why they're disabled.

Disabled elements don't emit pointer events, so wrapping them in a span enables tooltip functionality.

Multiple Tooltips

Use multiple tooltips in close proximity.

Tooltip with Long Content

Handle longer tooltip content appropriately.

Tooltips automatically wrap long content, but keep tooltip text concise for better user experience.

Tooltip in Tables

Add tooltips to table cells for additional context.

Tooltip with Icons

Combine tooltips with icons for informative UI elements.

Stacking above popovers

--z-index-tooltip and --z-index-popover share the same token value. .pr-tooltip therefore uses calc(var(--z-index-tooltip) + 100) so a tooltip on a control inside a popover always paints above the popover surface. Do not raise the --z-index-tooltip token itself for this — the .pr-z-index-tooltip utility is reused by snackbars and other chrome that must stay in the shared band.

Positioning Considerations

Tooltips automatically adjust position when there's insufficient space.

Radix UI automatically flips the tooltip to the opposite side if there isn't enough space in the specified direction.

Previous

Tooltip / Usage

Next

Accessibility / Keyboard Support

On this page

Props
Storybook
Basic Tooltip
Tooltip Positioning
Top Tooltip
Right Tooltip
Bottom Tooltip
Left Tooltip
Tooltip Alignment
Start Alignment
Center Alignment
End Alignment
Rich Content Tooltip
Tooltip on Icon Buttons
Tooltip on Text
Truncated Text with Tooltip
Disabled Tooltip
Controlled Tooltip
Tooltip with Custom Wrapper
Tooltip on Disabled Elements
Multiple Tooltips
Tooltip with Long Content
Tooltip in Tables
Tooltip with Icons
Stacking above popovers
Positioning Considerations