HoverCard
Focus-preserving profile preview on hover or native disclosure activation.
All components · Theme builder · Implementation source
Live preview
Install
netscript ui:add hover-cardUsage and examples
The preview runs this JSX with the installed components. Import any composed primitives from your UI directory.
import { useState } from 'preact/hooks';
import { HoverCard } from '@app/components/ui/hover-card.tsx';
export function Example() {
const [value, setValue] = useState('standard');
const [open, setOpen] = useState(false);
const [notice, report] = useState('');
return (<><div><HoverCard triggerLabel="Maya Rossi" title="Maya Rossi" description="Customer since 2024" /></div><p role="status">{notice}</p></>);
}Props
Generated from native deno doc --json --private over the shipped implementation. Compound component props retain their owning interface; native attributes pass through where declared.
| Owner | Prop | Type | Optional | Description |
|---|---|---|---|---|
HoverCardProps | triggerLabel | string | No | |
HoverCardProps | title | string | No | |
HoverCardProps | description | ComponentChildren | No | |
HoverCardProps | meta | ComponentChildren | Yes | |
HoverCardProps | avatar | ComponentChildren | Yes | |
HoverCardProps | placement | "top" | "right" | "bottom" | "left" | Yes | |
HoverCardProps | open | boolean | Yes | |
HoverCardProps | defaultOpen | boolean | Yes | |
HoverCardProps | onOpenChange | (open: boolean) => void | Yes | |
HoverCardProps | closeDelay | number | Yes | |
HoverCardProps | disabled | boolean | Yes | |
HoverCardProps | class | string | Yes |
Keyboard
| Key | Action |
|---|---|
Enter/Space | Toggle disclosure |
Escape | Close only the open preview and return trigger focus. |
Tab/Shift+Tab | Native focus navigation; preview never traps focus or steals it on entry. |
Tokens
Semantic contract roles: text/muted.
CSS custom properties referenced directly: --ns-border, --ns-border-width, --ns-card, --ns-card-padding, --ns-fg, --ns-muted-fg, --ns-radius-card, --ns-radius-control, --ns-ring, --ns-shadow-md, --ns-space-1, --ns-space-16, --ns-space-2, --ns-space-4, --ns-text-caption, --ns-text-small, --ns-text-strong, --ns-weight-strong.
Contract and compatibility
Accessibility pattern: WAI-ARIA guidance
- Public Popover with focusOnOpen=false; hover/focus preview and native disclosure button preserve trigger focus.
- Mouse hover previews; clicking an already-hovered trigger closes it. Touch/pen use activation-only toggle and pointer-induced focus does not open separately. Pointer transfer grace allows selecting/using preview content. Native focus exit/outside dismissal closes; no backend profile lookup.
- Runtime trigger/content retain open/closed; root uses rest/open.
Design contract values marked planned are not implementation props. The props above describe what ships today.