Skip to content

Tooltip

Reveal concise supporting text from keyboard focus or pointer hover.

Usage

Focus hover

Show the same supporting text from pointer hover and keyboard focus.

Show the same supporting text from pointer hover and keyboard focus.

Initially open

Begin open without occupying layout space around the trigger.

Begin open without occupying layout space around the trigger.

Controlled

Let the parent own the current value and apply accepted changes back to the component.

Let the parent own the current value and apply accepted changes back to the component.

Floating positioning

This component uses the shared positioning engine. Use the live positioning example to change side, align, offsets, collision boundaries, strategy, and tracking while inspecting the resolved placement.

API

Vue package: @sectile/vue/tooltip

Components
  • TooltipRoot
  • TooltipTrigger
  • TooltipPortal
  • TooltipContent
  • TooltipArrow

Props

TooltipRootProps

align

Alignment of positioned content relative to its anchor.

arrowPadding

Minimum space kept between an arrow and the edge of positioned content.

avoidCollisions

Whether positioned content may flip or shift to remain visible.

collisionBoundary

Boundary used to keep positioned content visible.

collisionPadding

Space kept between positioned content and its collision boundary.

defaultOpen

Initial uncontrolled open state.

disabled

Whether interaction is unavailable.

hideWhenDetached

Whether positioned content hides when its anchor leaves the layout.

open

Whether the associated popup or disclosure is open.

position

Whether the popup is positioned relative to its trigger.

side

Preferred side of the anchor for positioned content.

sideOffset

Distance between positioned content and its anchor.

strategy

CSS positioning strategy used for anchored content.

tracking

Update strategy used while anchored content is open.

unmountOnExit

Whether presence-managed content is removed from the DOM after its exit motion completes.

TooltipPartProps

as

Element or component rendered for this part.

asChild

Whether to merge this part into its single child instead of rendering a wrapper.

TooltipPortalProps

defer

Whether Teleport target resolution waits until the end of the current mount or update tick.

disabled

Whether interaction is unavailable.

to

Teleport target for portalled content.

Slots

TooltipRootSlotProps

disabled

Whether interaction is unavailable.

open

Whether the associated popup or disclosure is open.

Other types

TooltipOpenChangeHandler

ts
type TooltipOpenChangeHandler = PopupFactoryOptions['onOpenChange']

Parts

Shared scope: [data-scope="tooltip"]. Combine it with a part selector to keep styles local to this component.

PartSelectorRoleExtra attributes
trigger[data-part="trigger"]Opens, closes, or activates the associated content.
content[data-part="content"]Contains the component content shown for the active state.
arrow[data-part="arrow"]Visually connects floating content to its anchor.

Keyboard interaction

KeyBehavior
TabReveal the tooltip when its trigger receives keyboard focus.
EscapeDismiss the visible tooltip.

Accessibility

The tooltip is associated with its trigger as a description and never receives focus itself.

See the corresponding WAI-ARIA pattern for the host accessibility contract.

Released under the MIT License.