# HoverCard

Focus-preserving profile preview on hover or native disclosure activation.

[All components](https://rickylabs.github.io/netscript/design-system/components/) · [Theme builder](https://rickylabs.github.io/netscript/create/) · [Implementation source](https://github.com/rickylabs/netscript/blob/main/packages/fresh-ui/registry/components/ui/hover-card.tsx)

## Live preview

[Open live hover-card preview](https://rickylabs.github.io/netscript/assets/fresh-ui/preview/?component=hover-card&theme=studio-utility)

## Install

```bash
netscript ui:add hover-card
```

## Usage and examples

The preview runs this JSX with the installed components. Import any composed primitives from your UI directory.

```tsx
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](https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/)

- 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.
