Overlays
HoverCard
A rich preview shown when the pointer rests on, or keyboard focus reaches, a link — people, issues, linked records.
import { HoverCard } from '@reactloom/ui';Examples
Person mention
Assigned to @ada on Tuesday.
import { HoverCard, Link, Stack, Text } from '@reactloom/ui';
export default function Example() {
return (
<p style={{ margin: 0 }}>
Assigned to{' '}
<HoverCard
content={
<Stack gap="1">
<Text weight="semibold">Ada Lovelace</Text>
<Text size="sm" tone="muted">
Staff engineer · London · Usually replies within an hour
</Text>
<Link href="#profile">View profile</Link>
</Stack>
}
>
<Link href="#ada">@ada</Link>
</HoverCard>{' '}
on Tuesday.
</p>
);
}Linked record
Blocked by INC-482.
import { Badge, HoverCard, HStack, Link, Stack, Text } from '@reactloom/ui';
export default function Example() {
return (
<p style={{ margin: 0 }}>
Blocked by{' '}
<HoverCard
size="lg"
placement="top-start"
content={
<Stack gap="2">
<HStack gap="2" align="center">
<Text weight="semibold">INC-482 · Payments timing out</Text>
<Badge tone="danger">Open</Badge>
</HStack>
<Text size="sm">Card payments in the EU region fail after 30 seconds. Rollback in progress.</Text>
<Link href="#incident">Open incident</Link>
</Stack>
}
>
<Link href="#incident">INC-482</Link>
</HoverCard>
.
</p>
);
}API reference
| Prop | Type | Default |
|---|---|---|
childrenrequiredThe trigger, usually a link. | ReactElement | — |
contentrequiredPreview content; may contain links. | ReactNode | — |
placement | OverlayPlacement | 'bottom-start' |
openDelay · closeDelayIn ms. | number | 500 · 300 |
open / defaultOpen / onOpenChange | boolean | — |
size | 'sm' | 'md' | 'lg' | 'auto' | 'md' |
Customization
Extracted from the component’s source on every build, so it matches the code. How the layers fit together is explained in Customization.
State attributes
Target these in your CSS to style states without depending on class names.
| Attribute | Values |
|---|---|
[data-size] | sm · md · lg · auto |
Theme tokens it reads
--pl-color-bg-surface-raised --pl-color-border-default --pl-color-fg-default --pl-font-size-md --pl-radius-lg --pl-shadow-md
Accessibility
- Opens on focus as well as hover; Tab from the trigger enters the card and Tab out continues after the trigger.
- Escape closes it.
- Touch screens have no hover, so the same information must be where the trigger leads.
| Key | Action |
|---|---|
| Tab | Into the open card, then on past the trigger |
| Escape | Close |
Usage guidelines
Do
- Use for previews that save a click.
- Keep the trigger a real link to the full record.
Don’t
- Don’t put the only copy of information or an essential action in a hover card.