Tooltip

Alignment target:@astryxdesign/core v0.7.1 · Tooltip

Tooltip Props #

NameTypeDefaultDescription
contentstring—Tooltip text. Use the content slot for rich content.
placement'above' | 'below' | 'start' | 'end''above'Side of the trigger. Flips when there is no room.
alignment'start' | 'center' | 'end''center'Alignment along the placement axis.
delaynumber200Milliseconds before showing on hover.
hideDelaynumber0Milliseconds before hiding. 0 uses a 100ms bridge so the pointer can reach the bubble.
focusTrigger'auto' | 'always' | 'never''auto'Whether focus shows the tooltip. auto listens only when the trigger is focusable.
touchTrigger'auto' | 'tap' | 'none''auto'Tap behavior on touch. auto skips buttons, links, and form controls.
isEnabledbooleantrueDisables hover and focus triggers when false.
hasHoverIndication'auto' | boolean'auto'Dashed underline on a text-only trigger. auto applies it only to text.
isOpenboolean—Controlled visibility. Hover and focus are ignored when set.
isDefaultOpenbooleanfalseShow on mount.
anchorsOnSelfbooleanfalseSkips the wrapper span so the slot root element is the trigger. Needed for headings and paragraphs.
anchorHTMLElement | null—External element used as the trigger. No wrapper is rendered, the default slot can be omitted, and focus, hover and aria-describedby are wired to that element.

Events #

  • openChange(isOpen: boolean): fires when the tooltip shows or hides. With isOpen, it fires with false on Escape and the parent decides whether to close.

Slots #

  • default: the trigger.
  • content: rich tooltip content. Replaces the content prop text.

Theme #

CSS
.my-tooltip {
  --astryx-tooltip-background: #000;
  --astryx-tooltip-foreground: #fff;
}
  • --astryx-tooltip-background: bubble background.
  • --astryx-tooltip-foreground: bubble text color.
  • --astryx-tooltip-indication-color: dashed underline color.
  • --astryx-tooltip-z-index: stacking order of the bubble.