
Accessible tooltip with auto-positioning and delay.
pnpm dlx edbn-ui@latest add tooltipCreate a file and paste the following code into it.
Provides shared delay settings for tooltips and instant-open grouping. Doesn't render its own HTML element.
delaynumber600Shared delay before opening a tooltip in milliseconds
closeDelaynumber0Shared delay before closing a tooltip in milliseconds
timeoutnumber400Window where another tooltip opens instantly after one closes
childrenReactNodeTooltip subtree
Groups all parts of the tooltip. Doesn't render its own HTML element.
defaultOpenbooleanfalseInitial open state
openbooleanControlled open state
onOpenChange(open: boolean, details: Tooltip.Root.ChangeEventDetails) => voidCalled when the tooltip opens or closes
onOpenChangeComplete(open: boolean) => voidCalled after animation completes
disableHoverablePopupbooleanfalseClose when the pointer leaves the trigger
trackCursorAxis'none' | 'x' | 'y' | 'both''none'Track cursor movement for positioning
actionsRefRefObject<Tooltip.Root.Actions | null>Imperative close and unmount actions
disabledbooleanfalseDisable the tooltip root
handleTooltip.Handle<Payload>Handle for detached triggers
defaultTriggerIdstring | nullInitial associated trigger id
triggerIdstring | nullControlled associated trigger id
childrenReactNode | PayloadChildRenderFunction<Payload>Tooltip content or payload-aware render child
An element that opens the tooltip on hover or focus. Renders a button element.
handleTooltip.Handle<Payload>Associates this trigger with a detached root
payloadPayloadPayload passed to a render-child root
delaynumber600Delay before hover/focus open in milliseconds
closeOnClickbooleantrueClose when the trigger is clicked
closeDelaynumber0Delay before closing in milliseconds
disabledbooleanfalsePrevent this trigger from opening the tooltip
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-popup-open | Present when tooltip is open |
| data-trigger-disabled | Present when this trigger is disabled |
Moves the popup to a different part of the DOM. Renders a div element.
containerHTMLElement | ShadowRoot | RefObject | nullPortal container
keepMountedbooleanfalseKeep in DOM when closed
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
Positions the popup against the trigger. Renders a div element.
sideSide'top'Side relative to anchor
sideOffsetnumber | OffsetFunction0Distance from anchor
alignOffsetnumber | OffsetFunction0Offset along the alignment axis
arrowPaddingnumber5Minimum arrow distance from popup edges
anchorElement | VirtualElement | RefObject | function | nullCustom positioning anchor
collisionAvoidanceCollisionAvoidanceFlip, shift, or disable collision handling
collisionBoundaryBoundary'clipping-ancestors'Boundary used for collision detection
collisionPaddingPadding5Space from the collision boundary
disableAnchorTrackingbooleanfalseDisable tracking layout shifts of the anchor
stickybooleanfalseKeep visible after the anchor scrolls away
positionMethod'absolute' | 'fixed''absolute'CSS positioning strategy
align'start' | 'center' | 'end''center'Alignment relative to side
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-open | Present when tooltip is open |
| data-closed | Present when tooltip is closed |
| data-anchor-hidden | Present when the anchor is hidden |
| data-side | Side tooltip is positioned on |
| data-align | Alignment relative to side |
| Variable | Description |
|---|---|
| --anchor-height | Anchor height |
| --anchor-width | Anchor width |
| --available-height | Available height between anchor and viewport edge |
| --available-width | Available width between anchor and viewport edge |
| --transform-origin | Transform origin for anchored animations |
A container for the tooltip content. Renders a div element.
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-open | Present when tooltip is open |
| data-closed | Present when tooltip is closed |
| data-align | Alignment relative to side |
| data-instant | Present when animations should be skipped |
| data-side | Side popup is positioned on |
| data-starting-style | Present when animating in |
| data-ending-style | Present when animating out |
| Variable | Description |
|---|---|
| --popup-height | Current popup height |
| --popup-width | Current popup width |
Displays an arrow element positioned against the anchor. Renders a div element.
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-open | Present when tooltip is open |
| data-closed | Present when tooltip is closed |
| data-uncentered | Present when the arrow cannot be centered |
| data-align | Alignment relative to side |
| data-instant | Present when animations should be skipped |
| data-side | Side popup is positioned on |
A viewport for animating content transitions between trigger payloads. Renders a div element.
childrenReactNodeContent to render inside the transition container
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-activation-direction | Direction from the previous trigger to the new trigger |
| data-current | Applied to the current content container |
| data-instant | Present when animations should be skipped |
| data-previous | Applied to the exiting content container |
| data-transitioning | Present while content is transitioning |
| Variable | Description |
|---|---|
| --popup-height | Parent popup height for transition containers |
| --popup-width | Parent popup width for transition containers |
Base UI handle utility for detached triggers and imperative tooltip control.
isOpenbooleanreadonlyWhether the associated tooltip is open
open(triggerId: string) => voidmethodOpen and associate the tooltip with a trigger id
close() => voidmethodClose the associated tooltip
Function exported as createTooltipHandle for creating typed detached-trigger handles.
returnTooltip.Handle<Payload>A new imperative tooltip handle