Skip to content

Early previewhamur is not on npm yet. The components are being built in the open, follow along on GitHub.

UIComponentsReact

Hover Card

A card that previews what is behind a link when the reader hovers it.

Built on the headless Preview Card.See its API in Docs

Rendered by React 19.3.1

hover-card.tsx

Installation

npx shadcn@4.23.0 add https://hamur.dev/r/react/hover-card.json

It also adds utils. The app needs its setup first: Installation.

Usage

HoverCard holds HoverCardTrigger and HoverCardContent; the content brings its own portal and positioner and takes side (bottom by default), sideOffset, align and alignOffset. In Angular the template writes basePreviewCardPortal itself. It is the headless Preview Card: the trigger's delay and closeDelay set how long the pointer rests before it opens and after it leaves. The card is for sighted pointer users: what it shows should also be reachable through the link.

import { HoverCard, HoverCardContent, HoverCardTrigger } from '@/components/ui/hover-card'

Examples

Default

A link that previews a profile with an avatar.

Its preview and code are at the top of the page.

API reference

The styled parts pass every prop to the headless part they wrap and add classes. The props, data attributes and keyboard are on Preview Card's API reference.