Skip to content

Tooltip

Tooltip

PTooltip displays short helper content on hover or focus and automatically repositions to stay in the viewport.

Demo

Usage

<PTooltip text="Copied to clipboard">
<PButton size="sm">Copy</PButton>
</PTooltip>
<PTooltip
text="Status details"
preferred-position="right"
display="block"
:anchor-class="['max-w-sm']"
:anchor-style="{ marginTop: '0.5rem' }"
>
<PButton size="sm" type="success">Block trigger</PButton>
</PTooltip>

Use display, anchorClass, and anchorStyle when the trigger wrapper needs to participate in layout or carry utility classes/styles. These props affect the trigger element, not the teleported tooltip panel.

Props

PropTypeDefaultNotes
textString''Fallback tooltip text when no content slot is provided.
preferredPositionStringtoptop, bottom, left, right.
displayStringinlineControls the trigger wrapper element: inline renders a span, block renders a div.
anchorClass`StringArrayObject`
anchorStyle`StringObject`{}
maxWidthNumber280Max width in pixels.
typeStringinfomain, complementary, success, warning, danger, info.
purposeStringaccentaccent or filled.
arrowVariantStringnonesemantic, neutral, split, tint, none.
borderedBooleanfalseAdds a border style variant.
animateBooleantrueEnables enter animation.
animationDistanceNumber10Enter animation travel distance in pixels.
animationDurationNumber140Enter animation duration in milliseconds.

Events

PTooltip does not emit custom events.

Slots

SlotDescription
defaultTrigger element.
contentOptional custom tooltip body content.