navius

Tooltip

A popup that displays information related to an element when the element receives keyboard focus or the mouse hovers over it.

Features

  • Opens on hover after a configurable delay, and instantly on keyboard focus.
  • The provider's skip-delay window opens the next tooltip instantly (data-instant).
  • Can be controlled (@bind-Open) or uncontrolled (DefaultOpen).
  • Content self-portals to document.body, escaping overflow and stacking clip.
  • Collision-aware positioning with optional arrow, exposed via data-side / data-align.
  • Hoverable content by default; dismisses on Escape, blur, press, or outside pointer-down.

Installation

Install the brain, or copy just this primitive in with the CLI.

Anatomy

Import the parts and assemble them. Wrap your app once in a provider to share delay defaults.

API Reference

Cascades shared delay, skip-delay, and hoverable defaults to every tooltip beneath it. Renders no DOM. Wrap once near the app root.

Prop Type Default
DelayDuration int 700
SkipDelayDuration int 300
DisableHoverableContent bool false
ChildContent RenderFragment? -

Owns the open state and the show/hide timing. Renders no DOM.

Prop Type Default
Open bool false
OpenChanged EventCallback<bool> -
DefaultOpen bool false
DelayDuration int? -
OpenDelay int 200
DisableHoverableContent bool? -
ChildContent RenderFragment? -

The control that opens the tooltip on hover or focus. Renders a button.

Prop Type Default
ChildContent RenderFragment? -
Data attribute Values
[data-popup-open] Present while the tooltip is open.

The tooltip bubble, self-portaled to the body and wrapped by the Positioner that anchors it against the trigger. Renders a div with role="tooltip". The Side / Align / SideOffset / AlignOffset / AvoidCollisions / CollisionPadding / Sticky / HideWhenDetached / ArrowPadding props are set on the enclosing Positioner.

Prop Type Default
Side string "top"
Align string "center"
SideOffset double 6
AlignOffset double 0
AvoidCollisions bool true
CollisionPadding double? -
Sticky string? -
HideWhenDetached bool false
ArrowPadding double 0
KeepMounted bool false
Container string? -
OnEscapeKeyDown EventCallback<NaviusEscapeKeyDownEventArgs> -
OnPointerDownOutside EventCallback<NaviusPointerDownOutsideEventArgs> -
ChildContent RenderFragment? -
Data attribute Values
[data-open] Present while open.
[data-closed] Present while closing (through the exit transition).
[data-instant] Present when the tooltip opened instantly (no hover delay).
[data-starting-style] Present at the start of the open transition.
[data-ending-style] Present at the start of the close transition.
[data-side] "top" | "right" | "bottom" | "left"
[data-align] "start" | "center" | "end"

An optional SVG triangle the positioner rotates to point at the trigger. Place inside Content. Renders an svg.

Prop Type Default
Width double 10
Height double 5
Data attribute Values
[data-side] "top" | "right" | "bottom" | "left"

Accessibility

Adheres to the tooltip WAI-ARIA design pattern. The trigger points at the content with aria-describedby while open.

Key Description
Tab Moves focus to the trigger, opening the tooltip instantly.
Space If open, closes the tooltip without activating a hover delay.
Enter If open, closes the tooltip without activating a hover delay.
Escape Closes the tooltip.