Tooltip
A popup that displays information related to an element when the element receives keyboard focus or the mouse hovers over it.
<NaviusTooltipProvider DelayDuration="300">
<NaviusTooltip>
<NaviusTooltipTrigger aria-label="Add to library"
class="... hover:bg-accent data-[open]:bg-accent">
<PlusIcon />
</NaviusTooltipTrigger>
<NaviusTooltipPositioner Side="top" SideOffset="6">
<NaviusTooltipPopup
class="... bg-popover text-popover-foreground shadow-md">
Add to library
<NaviusTooltipArrow class="fill-popover" />
</NaviusTooltipPopup>
</NaviusTooltipPositioner>
</NaviusTooltip>
</NaviusTooltipProvider>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.
navius add tooltipAnatomy
Import the parts and assemble them. Wrap your app once in a provider to share delay defaults.
@using Navius.Primitives.Components.Tooltip
<NaviusTooltipProvider>
<NaviusTooltip>
<NaviusTooltipTrigger />
<NaviusTooltipPositioner>
<NaviusTooltipPopup>
<NaviusTooltipArrow />
</NaviusTooltipPopup>
</NaviusTooltipPositioner>
</NaviusTooltip>
</NaviusTooltipProvider>API Reference
Provider
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? | - |
Root
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? | - |
Trigger
The control that opens the tooltip on hover or focus. Renders a button.
| Prop | Type | Default |
|---|---|---|
| ChildContent | RenderFragment? | - |
Data attributes
| Data attribute | Values |
|---|---|
| [data-popup-open] | Present while the tooltip is open. |
Popup
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 attributes
| 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" |
Arrow
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 attributes
| 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.
Keyboard interactions
| 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. |