base-ui-svelte

Tooltip

A popup that displays information related to an element when hovered or focused.

View as Markdown

API Reference

Props mirror Base UI React where applicable, adapted for Svelte 5. Native HTML attributes for the rendered element are also accepted unless noted.

Tooltip.Root

Extends div HTML attributes.

PropertyTypeDefaultDescription
openboolean | undefinedWhether the component is open (controlled).
defaultOpenbooleanWhether the component is initially open (uncontrolled).
onOpenChange((open: boolean, eventDetails: { reason: OpenChangeReason }) => void) | undefinedEvent handler called when the open state changes.
delaynumberAlias for `openDelay` (Base UI name).
openDelaynumberHow long to wait before opening on hover (ms).
closeDelaynumber
childrenSnippet<[{ open: boolean }]>Content rendered inside the part.
Data attributeDescription
data-closedPresent when the part is closed.
data-openPresent when the part is open.

Tooltip.Arrow

Extends span HTML attributes.

PropertyTypeDefaultDescription
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-closedPresent when the part is closed.
data-openPresent when the part is open.

Tooltip.Popup

Extends div HTML attributes.

PropertyTypeDefaultDescription
renderstringHTML element tag to render instead of the default host element.
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-closedPresent when the part is closed.
data-ending-stylePresent while the exit animation can run.
data-openPresent when the part is open.
data-starting-stylePresent while the enter animation can run.

Tooltip.Portal

PropertyTypeDefaultDescription
childrenSnippetContent rendered inside the part.

Tooltip.Positioner

Extends div HTML attributes.

PropertyTypeDefaultDescription
sideSide
alignAlign
sideOffsetnumber
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-closedPresent when the part is closed.
data-openPresent when the part is open.
data-sideThe side the popup is placed on.

Tooltip.Trigger

Extends button HTML attributes.

PropertyTypeDefaultDescription
renderstringHTML element tag to render instead of the default host element.
disabledbooleanfalseWhether the control ignores user interaction.
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-closedPresent when the part is closed.
data-disabledPresent when the part is disabled.
data-openPresent when the part is open.