Install
Pull Hover Card from the barrel for everyday use, or the granular path when you want a tighter bundle.
import { HoverCard } from "@brika/clay";import { HoverCard } from "@brika/clay/components/hover-card";A minimal example
Drop this into a page. Native HTML attributes pass through to the underlying primitive.
import { Button } from '@brika/clay/components/button';
import {
HoverCard,
HoverCardContent,
HoverCardTrigger,
} from '@brika/clay/components/hover-card';
/** Hover over an inline element to preview non-critical supplemental content. */
export default function HoverCardDefaultDemo() {
return (
<HoverCard>
<HoverCardTrigger asChild>
<Button variant="link">@brika</Button>
</HoverCardTrigger>
<HoverCardContent className="w-72">
<div className="flex flex-col gap-1">
<p className="font-semibold text-sm">Brika Labs</p>
<p className="text-muted-foreground text-sm">
Building Clay, the React component library and design system for Brika products.
</p>
<p className="text-muted-foreground text-xs">Joined January 2024</p>
</div>
</HoverCardContent>
</HoverCard>
);
}Hover Card, every way
Accessibility
- Content opens on hover AND focus, keyboard users can trigger it via Tab.
- Not suitable for content that must be permanently reachable, use
Popoverfor interactive content. - Ensure the trigger is keyboard-focusable; an
asChildlink or button works well.
Theme tokens
Every CSS variable Hover Card reads, with its default and the
dotted path you'd write in a ThemeConfig JSON
to override it. Set any of these in your theme to retune Hover Card
without touching component code.
Hover Card tokens
12 tokens--hover-card-surface-containercolorvar(--popover)components.hoverCard.surfaceContainerBackground of the hover-card surface.
--hover-card-surface-labelcolorvar(--popover-foreground)components.hoverCard.surfaceLabelDefault foreground color inside the hover-card.
--hover-card-radiusradiusvar(--radius-surface)components.hoverCard.radiusHoverCard corner radius.
--hover-card-padding-xsizecalc(var(--spacing) * 3)components.hoverCard.paddingXInline padding inside the hover-card.
--hover-card-padding-ysizecalc(var(--spacing) * 3)components.hoverCard.paddingYBlock padding inside the hover-card.
--hover-card-gapsizecalc(var(--spacing) * 2)components.hoverCard.gapGap between adjacent children inside the hover-card.
--hover-card-border-widthborder-width1pxcomponents.hoverCard.borderWidthBorder width on the hover-card. Set non-zero for outline-style variants.
--hover-card-border-styleborder-stylesolidcomponents.hoverCard.borderStyleBorder style on the hover-card (`solid`, `dashed`, `double`, `none`).
--hover-card-shadowshadowvar(--shadow-overlay)components.hoverCard.shadowHoverCard elevation.
--hover-card-backdrop-blurblur0pxcomponents.hoverCard.backdropBlurBackdrop blur on the hover card. Set non-zero for a frosted-glass surface.
--hover-card-durationdurationvar(--motion-standard-duration)components.hoverCard.durationTransition duration for hover-card state changes.
--hover-card-easingeasingvar(--motion-standard-easing)components.hoverCard.easingTransition easing for hover-card state changes.
Override in a theme
Authoring a theme is plain JSON. Drop overrides under
components.hoverCard, the names
are camelCase versions of the variable suffix.
{
"id": "my-theme",
"name": "My Theme",
"description": "...",
"accentSwatches": ["#000"],
"components": {
"hoverCard": {
"paddingX": "calc(var(--spacing) * 3)"
}
}
}
Then apply with applyTheme(myTheme)
(see the theming guide),
scope it to a subtree with themeToCssVars(myTheme, mode),
or consume any token directly in your own JSX with the matching Tailwind utility
(e.g. bg-hover-card-…) — see the
chips on each token row.
API reference
Props specific to Hover Card. Native HTML attributes pass through to the underlying primitive, see the component source on GitHub for the full type signature.
<HoverCard />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<HoverCardContent />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<HoverCardTrigger />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.