Skip to main content

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

Features

Installation

typo3 ui:add tooltip

Read more about installing Components and Primitives.

Examples

Custom Positioning

Control where the tooltip appears relative to the trigger.

Open Delay

Set a custom delay before the tooltip opens.

Close Delay

Set a custom delay before the tooltip closes after the pointer leaves.

Disabled Interaction

Prevent the tooltip from opening on hover.

On Icon Buttons

Common pattern for icon-only buttons that need accessible labels.

API Reference

The following tables cover the available props of the Fluid Primitives. For a full list of available client side props and methods, see the Zag.js Machine API.

tooltip.root

Provides tooltip state and context for the composed parts. Renders no wrapper element.

NameDescriptionRequiredDefault
defaultOpenboolean
The initial open state of the tooltip when rendered. Use when you don't need to control the open state of the tooltip.
No
false
disabledboolean
Whether the tooltip is disabled.
No
false
openDelayinteger
The open delay of the tooltip.
No
400
closeDelayinteger
The close delay of the tooltip.
No
150
closeOnPointerDownboolean
Whether to close the tooltip on pointerdown.
No
true
closeOnEscapeboolean
Whether to close the tooltip when the Escape key is pressed.
No
true
closeOnScrollboolean
Whether the tooltip should close on scroll.
No
true
closeOnClickboolean
Whether the tooltip should close on click.
No
true
interactiveboolean
Whether the tooltip's content is interactive and remains open when hovered.
No
false
positioningarray
The user provided options used to position the popover content.
No
-
rootIdstring
The root ID of the component, used for hydration and identification.
No
-
idsarray
The IDs of of the component parts for composition.
No
[]
controlledboolean
If true, the component is meant to be initialized manually inside another component
No
false

tooltip.trigger

Acts as the anchor that opens the tooltip. Renders a <button> element.

NameDescriptionRequiredDefault
valuestring
No
-
asChildboolean
If true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props.
No
-
classstring
The CSS class(es) to be applied to the component.
No
-
attributesarray
Additional attributes that should be rendered on the component where ui:attributes is used.
No
[]

Rendered data attributes

AttributeDescription
data-scopetooltip
data-parttrigger
data-valueThe value of the item
data-currentPresent when current
data-expandedPresent when expanded
data-state"open" | "closed"

tooltip.positioner

Positions the tooltip content relative to the trigger. Renders a <div> element.

NameDescriptionRequiredDefault
asChildboolean
If true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props.
No
-
classstring
The CSS class(es) to be applied to the component.
No
-
attributesarray
Additional attributes that should be rendered on the component where ui:attributes is used.
No
[]

tooltip.content

Displays the tooltip bubble content. Renders a <div> element.

NameDescriptionRequiredDefault
asChildboolean
If true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props.
No
-
classstring
The CSS class(es) to be applied to the component.
No
-
attributesarray
Additional attributes that should be rendered on the component where ui:attributes is used.
No
[]

Rendered data attributes

AttributeDescription
data-scopetooltip
data-partcontent
data-state"open" | "closed"
data-instant
data-placementThe placement of the content
data-sideThe side of the trigger that the content is positioned on

tooltip.arrow

Displays a decorative tooltip arrow. Renders a <div> element.

NameDescriptionRequiredDefault
asChildboolean
If true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props.
No
-
classstring
The CSS class(es) to be applied to the component.
No
-
attributesarray
Additional attributes that should be rendered on the component where ui:attributes is used.
No
[]

Machine JavaScript API

NameTypeDescription
openbooleanWhether the tooltip is open.
setOpen(open: boolean) => voidFunction to open the tooltip.
triggerValuestring | nullThe trigger value
setTriggerValue(value: string | null) => voidFunction to set the trigger value
reposition(options?: Partial<PositioningOptions>) => voidFunction to reposition the popover

Accessibility

KeyDescription
TabOpens/closes the tooltip without delay.
EscapeIf open, closes the tooltip without delay.

Anatomy

<primitives:tooltip.root>
    <primitives:tooltip.trigger />
    <primitives:tooltip.positioner>
        <primitives:tooltip.content>
            <primitives:tooltip.arrow />
        </primitives:tooltip.content>
    </primitives:tooltip.positioner>
</primitives:tooltip.root>