Skip to content
Nana UI

Tooltip

View .md Download

A small contextual label that appears on hover or keyboard focus. Wrap the trigger in the default slot and pass the text via the content attribute (or the content slot for rich markup). Shows on hover and focus for accessibility, dismisses on Escape, and flips on the main axis when it would overflow the viewport.

Hover me
Terminal window
npm install @nana-tec/ui-components
import "@nana-tec/ui-components/tooltip";
<nana-tooltip content="Saves your changes">
<nana-button>Hover me</nana-button>
</nana-tooltip>
Top Right Bottom Left
Dark Light Success Danger Info Warning

Properties

PropertyAttributeTypeDefaultDescription
arrowbooleanfalseShow a pointing arrow.
closeDelayclose-delaynumber0Delay before hiding on leave/blur, in ms.
contentstring''Plain-text tooltip content. Ignored when the `content` slot is used.
disabledbooleanfalseDisable the tooltip entirely.
openbooleanfalseOpen state (use with `trigger="manual"` for full control).
openDelayopen-delaynumber300Delay before showing on hover/focus, in ms.
placementTooltipPlacement'top'Where the tooltip sits relative to the trigger.
sizeTooltipSize'md'Size scale.
triggerTooltipTrigger'hover'What opens the tooltip. `hover` also responds to keyboard focus.
variantTooltipVariant'dark'Colour theme.

Events

EventDescription
nana-showFired when the tooltip opens
nana-hideFired when the tooltip closes

Slots

SlotDescription
(default)The trigger element the tooltip describes
contentRich tooltip content (overrides the `content` attribute)

CSS parts

PartDescription
::part(base)The positioning container
::part(body)The tooltip bubble
::part(arrow)The arrow

CSS custom properties

PropertyDescription
--nana-tooltip-bgBubble background
--nana-tooltip-colorBubble text colour
--nana-tooltip-max-widthMax bubble width before wrapping
EventTypeDescription
nana-showCustomEventFired when the tooltip opens
nana-hideCustomEventFired when the tooltip closes
SlotDescription
(default)The trigger element the tooltip describes
contentRich tooltip content (overrides the content attribute)
VariableDefaultDescription
--nana-tooltip-bgBubble background
--nana-tooltip-colorBubble text colour
--nana-tooltip-max-widthMax bubble width before wrapping
PartDescription
baseThe positioning container
bodyThe tooltip bubble
arrowThe pointing arrow
triggerThe trigger wrapper
  • Keyboard accessible
  • Screen-reader labels
  • Focus-visible states
  • ARIA roles and states
  • WCAG 2.2 AA contrast
Explore Tooltip interactively Every state, prop, and edge case — with live controls — in Storybook.
View in Storybook