HoverCard
Rich hover preview for user profiles, repo summaries, and linked entity details.
Component behavior
HoverCard displays supplementary content while the trigger or card is hovered. Required actions must remain available outside the hover card.
Use cases
- Summaries of linked users, repositories, or resources.
- Supplementary content without required actions.
- Previews displayed without leaving the current page.
Alternatives
Tooltip: a short text label is sufficient.
PopoverPanel: the content includes controls or must remain open.
Drawer: the task requires a complete record view.
Props
HoverCard reveals content on hover/focus. The card stays open while hovered, so the pointer can move from trigger to card without it vanishing.
| Prop | Type | Default | Description |
|---|---|---|---|
trigger | ReactElement | — | Element that reveals the card on hover/focus. |
children | ReactNode | — | Card content composed from HoverCardHeader, HoverCardBody, and HoverCardStats. |
openDelay | number | 350 | Delay before showing, in ms. |
closeDelay | number | 180 | Delay before hiding, in ms. |
placement | Placement | "bottom-start" | Card placement relative to trigger. |
offset | number | — | Gap between trigger and card, in px. |
width | number | 260 | Card width in px. |
disabled | boolean | — | Suppresses the card entirely. |
Sub-components
HoverCardHeader
| Prop | Type | Default | Description |
|---|---|---|---|
media | ReactNode | — | Avatar, logo, or status dot. |
title | ReactNode | — | Name or heading. |
subtitle | ReactNode | — | Handle, email, or secondary label. |
action | ReactNode | — | Right-aligned action content. |
HoverCardBody
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | — | Body text or content. |
HoverCardStats
| Prop | Type | Default | Description |
|---|---|---|---|
stats | { label: ReactNode; value: ReactNode }[] | — | Array of label/value pairs for the stat strip. |
Examples
User hover card
import {
HoverCard,
HoverCardHeader,
HoverCardBody,
HoverCardStats,
Avatar,
} from "@solarius/onset";
<HoverCard trigger={<a href="#">@jane</a>}>
<HoverCardHeader
media={<Avatar name="Jane Cooper" size="sm" />}
title="Jane Cooper"
subtitle="@janecooper"
/>
<HoverCardBody>Senior infrastructure engineer.</HoverCardBody>
<HoverCardStats
stats={[
{ label: "Repos", value: 47 },
{ label: "Followers", value: "2.3k" },
]}
/>
</HoverCard>;