Skip to content
Logic2BUI

Search docs

Search components and documentation

New
Menu

Hover Card

For sighted users to preview content available behind a link.

Installation

npx logic2b@next add hover-card

Usage

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

<HoverCard>
  <HoverCardTrigger>@logic2b</HoverCardTrigger>
  <HoverCardContent>
    Copy-paste components for building beautiful interfaces, fast.
  </HoverCardContent>
</HoverCard>

Examples

Profile

Custom Delay & Alignment

Accessibility

  • Built on Radix Hover Card: it opens on pointer hover and on keyboard focus of the trigger, so it is reachable with the Tab key.
  • It is a supplementary preview for sighted users — it does not trap focus and is not announced as a dialog, so never place essential content or actions only inside the card.
  • Escape dismisses an open card.

Live playground

Edit the component props and inspect the exact JSX before copying it. The preview loads only when this section enters the viewport.

Generated JSX
<HoverCard
  openDelay={100}
  closeDelay={100}
>
  <HoverCardTrigger
    href="#logic2b"
    className="font-medium underline underline-offset-4"
  >@logic2b</HoverCardTrigger>
  <HoverCardContent>Composable UI infrastructure for people and coding agents.</HoverCardContent>
</HoverCard>

API reference

Generated from the public TypeScript exports in src/ui/hover-card.tsx.

View JSON

HoverCard

Component
Props: React.ComponentProps<typeof HoverCardPrimitive.Root>

HoverCardTrigger

Component
Props: React.ComponentProps<typeof HoverCardPrimitive.Trigger>

HoverCardContent

Component
Props: React.ComponentProps<typeof HoverCardPrimitive.Content>
PropTypeRequiredDefaultDescription
align"center" | "end" | "start"No"center"—
sideOffsetnumberNo4—

Accessibility contract

Machine-readable behavior and consumer responsibilities for hover-card.

View JSON
Support
Primitive-managed
Pattern
hover preview
Radix Hover Card
Keyboard interactions for hover-card
KeysBehavior
TabFocusing the trigger reveals the preview.
EscapeClose the open surface and restore focus.

Built-in semantics

  • The preview opens for focus as well as pointer hover.

Consumer responsibilities

  • Keep the linked destination usable without the preview; do not put required actions only inside it.