# HoverCard

> An anchored panel that opens on hover or focus with a short delay, for richer previews than a tooltip — a profile card, a link preview.

- Package: `fancy-ui-react` (React 18/19 + Tailwind CSS v4)
- Category: Overlays
- Tags: overlay, hover, card, preview, anchored, accessibility
- Types: `HoverCardProps`
- Docs: https://fancy-ui.rama.app/docs/components/hover-card
- Source: https://github.com/RamaHerbin/fancy-ui/tree/main/react/src/components/hover-card

## Import

```tsx
import { HoverCard } from 'fancy-ui-react';
```

Setup (once per project): `npm install fancy-ui-react`, then put these lines in your main CSS file (the stylesheet import goes right after `@import "tailwindcss";`):

```css
@import "tailwindcss";
@import "fancy-ui-react/tailwind.css";
```

and import the component styles once in the app entry: `import "fancy-ui-react/styles.css";`. Full guide: https://fancy-ui.rama.app/llms.txt

The names below are the ones to write in React; when one differs from the Svelte name, the Svelte name follows in parentheses. `class` becomes `className`, a callback takes the name the React port declares (`onclick` becomes `onClick`), snippets become `ReactNode` props (render functions when they take arguments) and the default snippet is `children`. Divergences: https://github.com/RamaHerbin/fancy-ui/tree/main/react#divergences-from-the-svelte-api

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `open` | `boolean` | `false` | Whether the card is open. Bindable |
| `onOpenChange` | `(open: boolean) => void` | — | Fires whenever the open state changes, from any trigger |
| `side` | `"top" \| "bottom" \| "left" \| "right"` | `"bottom"` | Side of the trigger the card opens on. Flips when it would overflow |
| `align` | `"start" \| "center" \| "end"` | `"center"` | Alignment along the trigger's cross axis |
| `offset` | `number` | `8` | Gap in pixels between the trigger and the card |
| `openDelay` | `number` | `300` | Ms before the card opens after the pointer enters the trigger. Ignored for focus, which opens immediately |
| `closeDelay` | `number` | `150` | Ms before the card closes after the pointer leaves. Lets it travel from the trigger to the card without the card vanishing mid-trip |
| `className` (Svelte `class`) | `string` | — | Additional classes for the card panel |
| `ref` | `HTMLDivElement \| null` | `null` | Bindable reference to the trigger wrapper |

## Node props

| Prop | Description |
| --- | --- |
| `trigger` | The element that opens the card on hover or focus. Receives the card's id (or undefined while closed) — put it on your own trigger element's aria-describedby |
| `children` | The card's content. Supplementary only — see the README before adding links or buttons |

## Example

No React example is published for this component yet: start from the import above and the props table. The full examples are Svelte-only, on https://fancy-ui.rama.app/docs/components/hover-card.md.
