Tooltip

Overlay & Surface
stable

Contextual floating label anchored to an activator element. Appears on hover/focus, auto-positioned via location strategy.

Structure

Anatomie

Décomposition visuelle de la structure interne du composant avec les appels de classes BEM.

Anatomy of OrigamTooltipSchematic of the Tooltip overlay with 3 numbered internal parts. Tooltip text activator 1 2 3
Anatomy of <origam-tooltip> — overlay wraps a content div ① with the text ②; the activator ③ (any element) triggers visibility.
1.origam-tooltip
Root overlay element — transparent, zero-size. Wraps OrigamOverlay; positions via location strategy. role="tooltip" set explicitly.
2.origam-tooltip__content
Visible content surface. Background: neutral.800 (dark inverse). Contains the text or #default slot.
3[activator]
External activator element projected via #activator slot. Receives aria-describedby pointing to the tooltip id.

API

Props

Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et description.

id
string
HTML id applied to the tooltip content element. Auto-generated when omitted.
text
string
Tooltip label text. Can also be set via the #default slot.
class
string | Array<string> | object
style
string | Array<string> | object | StyleValue
absolute
boolean
closeOnBack
boolean
contentClass
string | Array<string>
contentProps
any
disabled
boolean
noClickAnimation
boolean
modelValue
boolean
v-model for the open state. Controlled mode when provided.
zIndex
number | string
disableGlobalStack
boolean
persistent
boolean
height
number | string
lazy
boolean
true
Defers rendering the content until the first open. Enabled by default for performance.
maxHeight
number | string
maxWidth
number | string
'300px'
Maximum tooltip width before content wraps.
minHeight
number | string
minWidth
number | string
width
number | string
target
'parent' | 'cursor' | TAnyString | Element | ComponentPublicInstance | [x: number, y: number] | undefined
activator
'parent' | 'cursor' | TAnyString | Element | ComponentPublicInstance
Reference to the activator element. Use the #activator slot instead for most cases.
activatorProps
any
{}
Props merged onto the activator element via the slot binder.
openOnClick
boolean
openOnContextMenu
boolean
openOnHover
boolean
openOnFocus
boolean
closeOnContentClick
boolean
closeDelay
number | string
openDelay
number | string
locationStrategy
TLocationStrategy | TLocationStrategyFn
location
'top'
Preferred position relative to the activator: top, bottom, start, end, and 2D variants (top start, bottom end, …).
origin
TAnchor | 'auto' | 'overlap'
Transform origin for the entry/exit transition. Defaults to the anchor point.
offset
number | string | Array<number>
Distance in pixels between the tooltip and the activator edge.
viewportMargin
number
scrollStrategy
'reposition'
Behavior when the container scrolls: reposition (follow activator) or close.
contained
boolean
eager
boolean
false
When true, the content is rendered in the DOM even before first open (disables lazy mounting).
transition
boolean | string | TTransitionProps
Enter/leave transition. Defaults to origam-translate-scale.
scrim
boolean | string
attach
boolean | string | Element | null
color
Foreground color of the tooltip text.
bgColor
Background color override. Defaults to neutral.800 (dark inverse surface).
fontSize
TFontSize
fontWeight
TFontWeight
lineHeight
TLineHeight

API

Slots

Emplacements de contenu exposés par ce composant.

#activator
The element that triggers the tooltip. Receives `props` to forward (aria-describedby, onMouseenter, onFocus, …) via v-bind.
#default
Tooltip content. Falls back to rendering the text prop as a plain span.

API

Emits

Événements émis par ce composant.

@update:modelValue
any
Fired when the open state changes.

API

Membres exposés

Propriétés et méthodes accessibles via ref template (defineExpose). Utilisés pour le contrôle programmatique.

<T extends object>(props: T, exclude?: string[]) => Partial<T>
Utility to forward a filtered subset of props to OrigamOverlay.
Ref<string>
Reactive CSS string for computed tooltip styles.
string
Unique ID for this tooltip instance (referenced by aria-describedby on the activator).
() => void
Injects the computed style sheet.
() => void
Removes the injected style sheet.
Ref<boolean>
True once the style sheet has been injected.
string
Unique style-sheet ID scoping injected CSS rules.

Personnalisation

Variables CSS

Propriétés CSS personnalisées exposées par ce composant. Surchargez-les pour personnaliser sans perdre la compatibilité avec le thème.

Tooltip background. Dark inverse surface for contrast in both themes.
Tooltip text color.
Font size of the tooltip label.
Corner radius of the tooltip pill.
Maximum width before tooltip text wraps.
Z-index of the tooltip overlay.
Enter/leave transition duration.

Inclusion

Accessibilité

Rôles ARIA, navigation clavier et gestion du focus. Sourcé depuis le template réel du composant.

Rôles ARIA

tooltip

Interactions clavier

Interactions clavier
ToucheAction
Tab / Shift+TabFocusing the activator opens the tooltip. Blurring closes it.
EscapeCloses the tooltip if it was opened via keyboard focus.

Notes

  • The activator element receives aria-describedby pointing to the tooltip id so screen readers announce the tooltip text.
  • role="tooltip" is applied directly on the OrigamOverlay element (not just the content div) so the association is unambiguous.
  • Transitions are disabled under prefers-reduced-motion: reduce.

Fondation

Design tokens

Extrait des tokens de ce composant — les variables --origam-<composant>---<propriété>, déclarées dans sa feuille de tokens tenue à la main, sans étape de build.

Source
color
var(--origam-color__neutral---800)
Dark inverse background for contrast in both themes.
color
var(--origam-color__text---inverse)
Inverse text color (white on dark surface).
dimension
var(--origam-radius---sm)
Corner radius.
duration
var(--origam-motion__duration---fast)
Enter/leave transition duration.
number
var(--origam-zIndex---tooltip)
Z-index layer.

Interactif

Playground

Modifiez les props en direct et observez le composant se mettre à jour. Le snippet de code généré suit vos changements.

Rendu de l’aperçu en cours…

Usage

Exemples

Extraits de code prêts à coller dans vos templates.

Basic tooltip

vue

Locations

vue

Colored tooltip

vue