Hover Card
A preview card that appears when a pointer rests on or focus reaches a link, built on the Radix HoverCard primitive.
Preview
Activity
Hover a name or number
- 2h
Malik Haddad merged #482
Retry failed webhooks with exponential backoff
- 4h
Priya Shah asked for review on #479
Empty state for saved views
- Yesterday
Ines Moreau drafted #485
Arrow-key navigation in data tables
Install
Add the editable source with the shadcn CLI. Your project also needs the shared theme tokens this component uses. Setup and requirements. The Pebble installer is not published yet.
npx shadcn@latest add https://pebbleui.com/r/hover-card.jsonProps
| Prop | Type | Default | Description |
|---|---|---|---|
| open | boolean | - | Controlled open state (HoverCard). |
| defaultOpen | boolean | false | Initial open state when uncontrolled (HoverCard). |
| onOpenChange | (open: boolean) => void | - | Called when the card opens or closes (HoverCard). |
| openDelay | number | 700 | Milliseconds before opening on hover or focus (HoverCard). |
| closeDelay | number | 300 | Milliseconds before closing after leave or blur (HoverCard). |
| side | "top" | "right" | "bottom" | "left" | "bottom" | Preferred side of the trigger (HoverCardContent). |
| align | "start" | "center" | "end" | "center" | Alignment against the trigger (HoverCardContent). |
| sideOffset | number | 6 | Gap in px from the trigger (HoverCardContent). |
Build notes
Same approach as `popover`: Radix `HoverCard` handles the open/close timers, pointer grace area, placement (floating-ui) and collision avoidance. The card uses `card` tokens (there is no popover token) with a border, `shadow-md` and a `forced-colors` border. Radix exposes `--radix-hover-card-content-transform-origin`, which `origin-(...)` applies so the card scales out of the trigger. Keyframes in the registry item `css` field: `hover-card-in` (opacity 0 and scale 0.96 to 1, 150 ms ease-out) and `hover-card-out` (reverse, 100 ms ease-in), keyed on `data-state` under `motion-safe:`; Radix's presence logic keeps the card mounted until the exit animation ends. The `tw-animate` utilities shadcn uses (`animate-in`, `slide-in-from-*`) are not in this repo, so the side-dependent slide is dropped. Default `sideOffset` is 6 px (shadcn uses 4), to match popover and leave room for the trigger's focus ring. **Pebble (2026-11-03).** The card now matches popover's Pebble raised surface: `rounded-xl bg-card`, `ring-1 ring-hairline`, `shadow-raised-md` and `inset-shadow-highlight` replace the border and `shadow-md`; forced colors keep a `CanvasText` border. Width stays 16rem. Timings move to tokens: `hover-card-in` at `--motion-base` / `--motion-enter`, `hover-card-out` at `--motion-fast` / `--motion-exit`, still under `motion-safe:` (the item may only use its own keyframes). The demo is an activity feed: each author name opens a profile card (avatar, role, city and local time, a note, merged/reviews counts and a 12-week sparkline drawn from fixed data), and each change number opens a change card (Merged / Open / Draft badge, branch, +/− counts with a five-block diff bar, checks passing or running, reviewers or "None yet"). The cards hold no controls, per the supplementary rule above. Triggers use a 2 px `ring` focus ring offset from the card. A unit test pins the raised-surface classes. <!-- PEBBLE-LICENSE -->
View source
registry/overlay/hover-card/hover-card.tsx
"use client";
/* PEBBLE-LICENSE
Built by Pebble. Component: hover-card.
First-party license: MIT
The following first-party terms apply only to original Pebble material.
MIT License
Copyright (c) 2026 Praxys Solutions LLC (Pebble)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
THIRD-PARTY NOTICES
These notices apply to identified upstream portions; Pebble terms do not replace or narrow their rights.
Upstream: https://raw.githubusercontent.com/shadcn-ui/ui/main/LICENSE.md
MIT License
Copyright (c) 2023 shadcn
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
END PEBBLE-LICENSE */
import * as React from "react";
import { HoverCard as HoverCardPrimitive } from "radix-ui";
import { cn } from "@/lib/utils";
export function HoverCard(props: React.ComponentProps<typeof HoverCardPrimitive.Root>) {
return <HoverCardPrimitive.Root data-slot="hover-card" {...props} />;
}
export function HoverCardTrigger(props: React.ComponentProps<typeof HoverCardPrimitive.Trigger>) {
return <HoverCardPrimitive.Trigger data-slot="hover-card-trigger" {...props} />;
}
export function HoverCardContent({
className,
align = "center",
sideOffset = 6,
...props
}: React.ComponentProps<typeof HoverCardPrimitive.Content>) {
return (
<HoverCardPrimitive.Portal>
<HoverCardPrimitive.Content
data-slot="hover-card-content"
align={align}
sideOffset={sideOffset}
className={cn(
"z-50 w-64 max-w-[calc(100vw-2rem)] rounded-xl bg-card p-4 text-sm text-card-foreground outline-none",
// Pebble raised surface: hairline ring, soft lift and a top highlight.
"shadow-raised-md ring-1 inset-shadow-highlight ring-hairline",
"forced-colors:border forced-colors:border-[CanvasText]",
// Grow out of the trigger: Radix sets the origin to the anchor side.
"origin-(--radix-hover-card-content-transform-origin)",
"motion-safe:data-[state=open]:animate-[hover-card-in_var(--motion-base)_var(--motion-enter)]",
"motion-safe:data-[state=closed]:animate-[hover-card-out_var(--motion-fast)_var(--motion-exit)]",
className,
)}
{...props}
/>
</HoverCardPrimitive.Portal>
);
}
