Basic Usage
Props Reference
The first argument: element that triggers the tooltip
Text or component to display in the tooltip
Real Example
From demo atdemo/demo.py:19:
Positioning
Which side of the trigger to position the tooltip
How to align the tooltip relative to the trigger
Distance between trigger and tooltip in pixels
Timing
Delay before showing tooltip on hover (milliseconds)
Delay before hiding tooltip after hover ends (milliseconds)
Controlled State
Whether tooltip is visible (controlled)
Initial visibility (uncontrolled)
Event fired when tooltip shows or hides
Event fired after animation completes
Disabled
Prevents tooltip from showing
Cursor Tracking
Makes tooltip follow the cursor on specified axis
Hoverable Content
When True, tooltip closes when pointer leaves trigger (even if moving to tooltip)
Compositional API
For advanced use cases:Tooltip Components
tooltip.root
Container for all tooltip parts.tooltip.trigger
Element that triggers the tooltip.tooltip.portal
Portals tooltip to document body.tooltip.positioner
Positions the tooltip.tooltip.popup
Tooltip content container.tooltip.arrow
Arrow pointing to trigger.tooltip.provider
Global configuration for nested tooltips.Styling Classes
Access predefined styles viaui.tooltip.class_names:
TRIGGER: Inline flex layoutPOPUP: Rounded container with dark background and white textARROW: Positioned arrow with rotation
Animation
Smooth scale and opacity transitions:- Scales from 90% to 100%
- Fades from 0 to 1 opacity
- 150ms transition duration
Collision Handling
Minimum distance from viewport edges
Keep tooltip visible after trigger scrolls out of view
Global Provider
Wrap your app to configure all tooltips:Duration where subsequent tooltips open instantly (milliseconds)
Accessibility
- Keyboard accessible (shows on focus, hides on blur/escape)
- ARIA attributes
- Screen reader support
- Proper role semantics
- Respects prefers-reduced-motion
Best Practices
- Keep content brief (1-2 short sentences)
- Don’t put interactive content in tooltips (use Popover instead)
- Ensure tooltips don’t hide critical information
- Test with keyboard navigation
- Avoid tooltips on mobile (no hover state)
Implementation Details
From source code atreflex_ui/components/base/tooltip.py:214:
- Built on Base UI Tooltip primitives
- High-level API takes trigger as first argument, content as second
- Default side_offset of 8px
- Default delays set to 0 for instant show/hide
- Auto-includes arrow SVG
- Hoverable popup disabled by default
- Dark background with white text styling