navius

Preview Card

For sighted users to preview content available behind a link.

Features

  • Opens on hover after a configurable OpenDelay, and immediately on keyboard focus.
  • Closes after a CloseDelay grace period so users can move from trigger to card.
  • Can be controlled (@bind-Open) or uncontrolled (DefaultOpen).
  • Custom side, alignment, offsets, and collision avoidance, with an optional arrow.
  • The engine self-portals the Popup to document.body to escape overflow and stacking ancestors.
  • Non-modal: no focus trap or scroll lock; dismisses on Escape or outside interaction.

Installation

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

Anatomy

Import the parts and assemble them. The Positioner and Popup replace the former Content; the Popup self-portals.

API Reference

Contains all the parts of a preview card and owns the open state plus open/close timing. Renders no DOM.

Prop Type Default
Open bool false
OpenChanged EventCallback<bool> -
DefaultOpen bool false
OpenDelay int 600
CloseDelay int 300
ChildContent RenderFragment? -

The link that opens the preview card on hover or focus. Renders an anchor.

Prop Type Default
ChildContent RenderFragment? -
Attributes IDictionary<string, object>? -
Data attribute Values
[data-popup-open] Present while the preview card is open.

Owns placement (side / align / offsets / collision). A flag-setter; the Popup renders the positioning element the engine anchors and writes data-side / data-align + --anchor-* onto.

Prop Type Default
Side string "bottom"
Align string "center"
SideOffset double 0
AlignOffset double 0
Flip bool true
AvoidCollisions bool true
CollisionPadding double? -
Sticky string "partial"
HideWhenDetached bool false
ArrowPadding double 0
ChildContent RenderFragment? -

The card panel, self-portaled and positioned by the engine against the trigger. role="dialog" but non-modal. Renders a div.

Prop Type Default
KeepMounted bool false
ChildContent RenderFragment? -
Attributes IDictionary<string, object>? -
Data attribute Values
[data-open] Present while the preview card is open.
[data-closed] Present while closing (through the exit transition).
[data-starting-style] Present on the first committed open frame.
[data-ending-style] Present while animating out.
[data-side] "top" | "right" | "bottom" | "left"
[data-align] "start" | "center" | "end"

An optional arrow the positioner keeps pointing at the trigger. Renders an svg.

Prop Type Default
Width double 10
Height double 5
ChildContent RenderFragment? -
Attributes IDictionary<string, object>? -
Data attribute Values
[data-side] "top" | "right" | "bottom" | "left"

Accessibility

The preview card is intended for sighted, mouse and keyboard users to preview content behind a link; it is not exposed as a dialog to assistive technology and its content should be reachable by other means.

Key Description
Tab Moves focus to the trigger, which opens the preview card.
Enter Activates the trigger link.
Escape Closes the preview card.