Hover Card (Base UI)
iconiq-ui/b-hover-cardFreeComponent
Hover card with the same Iconiq API layered over Base UI popover primitives, preserving delayed hover reveal, instant focus open, collision-aware placement, and spring-driven content motion.
Live preview
live · rendered by the registry
Rendered by Iconiq UI on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://www.iconiqui.com/r/b-hover-card.jsonSource
1"use client";23import { Popover as PopoverPrimitive } from "@base-ui/react/popover";4import { motion } from "motion/react";5import * as React from "react";67import { cn } from "@/lib/utils";89// ---------------------------------------------------------------------------10// Design tokens11// ---------------------------------------------------------------------------1213const controlCornerClassName =14 "rounded-lg supports-[corner-shape:squircle]:corner-squircle supports-[corner-shape:squircle]:rounded-[11px]";1516const surfaceCornerClassName =17 "rounded-lg supports-[corner-shape:squircle]:corner-squircle supports-[corner-shape:squircle]:rounded-[12px]";1819const hoverCardThemeClassName =20 "[--hc-surface:#ffffff] [--hc-foreground:#111111] [--hc-border:#e3e7ec] [--hc-ring:rgba(17,17,17,0.16)] dark:[--hc-surface:#111111] dark:[--hc-foreground:#f6f3ec] dark:[--hc-border:#2b2a25] dark:[--hc-ring:rgba(246,243,236,0.18)]";2122const hoverCardPanelClassName = cn(23 surfaceCornerClassName,24 "relative z-50 w-72 transform-gpu border border-[color:var(--hc-border)] bg-[color:var(--hc-surface)] p-4 text-[color:var(--hc-foreground)] shadow-none outline-none"25);2627const hoverCardTriggerClassName = cn(28 controlCornerClassName,29 "inline-flex min-h-9 cursor-pointer items-center px-1.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[color:color-mix(in_oklch,var(--hc-ring),transparent_40%)] focus-visible:ring-offset-2 focus-visible:ring-offset-[color:var(--hc-surface)]"30);3132// ---------------------------------------------------------------------------33// Types34// ---------------------------------------------------------------------------3536type Side = "top" | "right" | "bottom" | "left";37type Align = "start" | "center" | "end";38type CollisionPadding = React.ComponentPropsWithoutRef<39 typeof PopoverPrimitive.Positioner40>["collisionPadding"];4142type HoverCardContextValue = {43 actionsRef: React.RefObject<PopoverPrimitive.Root.Actions | null>;44 open: boolean;45 contentId: string;46 triggerId: string;47 getTriggerNode: () => HTMLElement | null;48 setContentNode: (node: HTMLDivElement | null) => void;49 setTriggerNode: (node: HTMLElement | null) => void;50 handleFocusEnd: (event: React.FocusEvent<HTMLElement>) => void;51 handleFocusStart: () => void;52 handleHoverEnd: (event: React.PointerEvent<HTMLElement>) => void;53 handleHoverStart: (event: React.PointerEvent<HTMLElement>) => void;54};5556// Base UI popup render function receives its own props shape57// … truncated
What it pulls in
npm packages
Files it writes
More from Iconiq UI
All 119 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | Iconiq UI | Components | Free | 2 deps | |
| AI Inputai-input | Iconiq UI | Components | Free | 3 deps | |
| Alertalert | Iconiq UI | Components | Free | 2 deps | |
| Avataravatar | Iconiq UI | Components | Free | 3 deps | |
| Accordion (Base UI)b-accordion | Iconiq UI | Components | Free | 2 deps | |
| Alert Dialog (Base UI)b-alert-dialog | Iconiq UI | Components | Free | 3 deps | |
| Autocomplete (Base UI)b-autocomplete | Iconiq UI | Components | Free | 3 deps | |
| Avatar (Base UI)b-avatar | Iconiq UI | Components | Free | 2 deps |
