Axon 911 Frontend DocsAxon 911 Frontend Docs
Axon 911 Frontend Docs
    Loading navigation…
U
User
Switch to light mode
  1. Components
  2. Tooltip
  3. API and Development

Tooltip

API and Development

View SourceOpens in a new tabSubmit IssueOpens in a new tab
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
NameTypeDefaultDescription
childrenReactNode—Trigger and {@link TooltipContent }.
announcebooleantrueWhether assistive technology is told about the tooltip. false is for a tooltip that repeats text the trigger already contains, such as the full text of a clipped label: the trigger gets no aria-describedby and the surface is aria-hidden with no tooltip role, so a screen reader reads the text once, from the trigger. Leave it true whenever the tooltip adds information the trigger's own content does not carry.
closeDelayMsnumber—Delay before closing after leave, in milliseconds. Defaults to the kernel hover close delay.
closeOnPressbooleantrueWhether pressing the trigger with a mouse or pen dismisses the tooltip. A press usually starts the action the tooltip describes, such as opening a dialog, and a tooltip that opens or stays open over that action is noise. A pending open is cancelled too, and the tooltip stays closed until the pointer leaves and returns. Keyboard focus is unaffected.
defaultOpenboolean—Initial open when uncontrolled.
disabledboolean—Disables hover and focus scheduling.
onOpenChange((open: boolean, details: ChangeDetails<ChangeReason>) => void)—Called when open changes from hover, focus, Escape, or blur.
openboolean—Controlled open state.
openDelayMsnumber—Delay before opening, in milliseconds. Defaults to the kernel hover open delay.
Storybook
Interactive examples and edge cases for this component are in Storybook.
DefaultOpens in a new tab
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