# Hover Card

- **Section:** Components
- **URL:** https://refast.fastapicloud.dev/docs/components/hover-card
- **Markdown:** https://refast.fastapicloud.dev/docs/components/hover-card.md
- **Source:** https://github.com/idling-mind/refast-docs/blob/main/docs/pages/components/data_display/hover_card.py
- **Live examples:** the widgets on this page need a browser; open the URL above to try them.
- **Applies to:** refast 0.12.2

For sighted users to preview content behind a link. A card appears when
the user hovers over the trigger element.

```python
from refast.components import HoverCard, HoverCardTrigger, HoverCardContent, Link

HoverCard(
    children=[
        HoverCardTrigger(children=[Link("@shadcn", href="#")]),
        HoverCardContent(
            children=[
                Avatar(fallback="SC"),
                Text("@shadcn — UI component library"),
            ]
        ),
    ]
)
```

Hover over the link below to see the card appear.

[@refast_framework](#)

@refast_framework

Python + React framework for reactive web apps.

Joined April 2026

```python
HoverCard(
    side="bottom",
    align="center",
    children=[
        HoverCardTrigger(
            children=[Link("@refast_framework", href="#")]
        ),
        HoverCardContent(
            children=[
                Row(gap=3, children=[
                    Avatar(fallback="RF", size="md"),
                    Column(gap=1, children=[
                        Text("@refast_framework"),
                        Text("Python + React framework."),
                    ]),
                ])
            ]
        ),
    ],
)
```

## HoverCard Props

| Prop | Type | Default | Description |
|------|------|---------|-------------|
| `children` | `list` | `[]` | A `HoverCardTrigger` and a `HoverCardContent`. |
| `open` | `bool \| None` | `None` | Controlled open state. |
| `default_open` | `bool` | `False` | Initial open state (uncontrolled). |
| `on_open_change` | `Callback \| None` | `None` | Fired when the open state changes. |
| `open_delay` | `int` | `700` | Milliseconds before the card opens on hover. |
| `close_delay` | `int` | `300` | Milliseconds before the card closes on mouse-leave. |
| `side` | `"top" \| "right" \| "bottom" \| "left"` | `"bottom"` | Preferred side of the trigger. |
| `align` | `"start" \| "center" \| "end"` | `"center"` | Alignment relative to the trigger. |
| `class_name` | `str` | `""` | Extra Tailwind classes. |

## HoverCardTrigger Props

| Prop | Type | Default | Description |
|------|------|---------|-------------|
| `children` | `list` | `[]` | The element that triggers the hover card (typically a `Link`). |
| `as_child` | `bool` | `False` | Merge props onto the child element. |
| `class_name` | `str` | `""` | Extra Tailwind classes. |

## HoverCardContent Props

| Prop | Type | Default | Description |
|------|------|---------|-------------|
| `children` | `list` | `[]` | Card content shown on hover. |
| `side` | `"top" \| "right" \| "bottom" \| "left"` | `"bottom"` | Preferred placement. |
| `side_offset` | `int` | `4` | Pixel gap from the trigger. |
| `align` | `"start" \| "center" \| "end"` | `"center"` | Alignment relative to the trigger. |
| `class_name` | `str` | `""` | Extra Tailwind classes. |

## User profile preview example

```python
HoverCard(
    children=[
        HoverCardTrigger(children=[Link("Alice Johnson", href="/users/alice")]),
        HoverCardContent(
            children=[
                Row(gap=3, children=[
                    Avatar(src="/avatars/alice.jpg", alt="Alice", size="lg"),
                    Column(gap=1, children=[
                        Text("Alice Johnson", class_name="font-semibold"),
                        Text("alice@example.com", class_name="text-sm text-muted-foreground"),
                        Badge(children=["Admin"]),
                    ]),
                ]),
            ]
        ),
    ]
)
```

---

Part of the Refast documentation: [all pages](https://refast.fastapicloud.dev/llms.txt), [everything on one page](https://refast.fastapicloud.dev/llms-full.txt), [search](https://refast.fastapicloud.dev/api/search?q=save_prop).
