Preview Card
For sighted users to preview content available behind a link.
<NaviusPreviewCard>
<NaviusPreviewCardTrigger href="https://github.com/lzitser23/navius"
class="... underline-offset-4 hover:underline">@@navius</NaviusPreviewCardTrigger>
<NaviusPreviewCardPositioner Side="bottom" SideOffset="8">
<NaviusPreviewCardPopup class="... w-72 rounded-md border bg-popover p-4 shadow-md
data-[open]:animate-in data-[closed]:animate-out">
<div class="flex gap-4">
<div class="... h-12 w-12 rounded-full bg-accent">NV</div>
<div class="space-y-1">
<h4 class="text-sm font-semibold">Navius</h4>
<p class="text-sm text-muted-foreground">Headless UI primitives for Blazor.</p>
<span class="text-xs text-muted-foreground">Joined December 2025</span>
</div>
</div>
<NaviusPreviewCardArrow class="fill-popover" />
</NaviusPreviewCardPopup>
</NaviusPreviewCardPositioner>
</NaviusPreviewCard>Features
- Opens on hover after a configurable
OpenDelay, and immediately on keyboard focus. - Closes after a
CloseDelaygrace 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.bodyto 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.
navius add preview-cardAnatomy
Import the parts and assemble them. The Positioner and Popup replace the former Content; the Popup self-portals.
@using Navius.Primitives.Components.PreviewCard
<NaviusPreviewCard>
<NaviusPreviewCardTrigger />
<NaviusPreviewCardPositioner>
<NaviusPreviewCardPopup>
<NaviusPreviewCardArrow />
</NaviusPreviewCardPopup>
</NaviusPreviewCardPositioner>
</NaviusPreviewCard>API Reference
Root
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? | - |
Trigger
The link that opens the preview card on hover or focus. Renders an anchor.
| Prop | Type | Default |
|---|---|---|
| ChildContent | RenderFragment? | - |
| Attributes | IDictionary<string, object>? | - |
Data attributes
| Data attribute | Values |
|---|---|
| [data-popup-open] | Present while the preview card is open. |
Positioner
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? | - |
Popup
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 attributes
| 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" |
Arrow
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 attributes
| 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.
Keyboard interactions
| Key | Description |
|---|---|
| Tab | Moves focus to the trigger, which opens the preview card. |
| Enter | Activates the trigger link. |
| Escape | Closes the preview card. |