Skip to content

Hover Card

Preview card shown when hovering or focusing a link.

Installation

bun add @xerobi/ui
import { HoverCard, HoverCardContent, HoverCardTrigger } from "@xerobi/ui/hover-card"

This component is client-side. In Astro, hydrate it with a client directive.

Examples

Default

import { HoverCard, HoverCardContent, HoverCardTrigger } from "@xerobi/ui/hover-card"

export function HoverCardDefault() {
  return (
    <HoverCard>
      <HoverCardTrigger render={<a href="#hover-card" className="text-body2 text-primary underline underline-offset-4" />}>@xerobi</HoverCardTrigger>
      <HoverCardContent>
        <p className="text-subtitle2">Xerobi UI</p>
        <p className="text-caption text-text-secondary">Components and blocks for Xerobi products.</p>
      </HoverCardContent>
    </HoverCard>
  )
}

API reference

HoverCard

Also accepts every prop of Base UI PreviewCard.

No props of its own.

HoverCardContent

No props of its own.

HoverCardTrigger

No props of its own.

Styling hooks: [data-slot="hover-card"], [data-slot="hover-card-trigger"], [data-slot="hover-card-portal"], [data-slot="hover-card-content"].

Search documentation

Search pages, components and blocks.