Search

Find a component, token or page

Base · Overlays

Hover card

A preview panel that appears when a link is hovered or focused.

HTML / JSPlannedReactStableReact NativeNot availableSwift (SwiftUI)PlannedGodotPlannedVueDraftSvelteDraftSolidDraft
Reviewed

Assigned to Northgate Freight

Props

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

<p className="text-sm text-muted-foreground">
  Assigned to{" "}
  <HoverCard>
    <HoverCardTrigger href="/carriers/northgate" className="font-medium text-foreground underline underline-offset-4">
      Northgate Freight
    </HoverCardTrigger>
    <HoverCardContent>
      <div className="flex gap-3">
        <div className="flex size-9 shrink-0 items-center justify-center rounded-md bg-muted">
          <TruckIcon className="size-4" aria-hidden="true" />
        </div>
        <div className="grid gap-1">
          <p className="font-medium">Northgate Freight</p>
          <p className="text-muted-foreground">Regional carrier covering the Midwest corridor.</p>
          <p className="text-xs text-muted-foreground">
            42 active shipments · <span className="text-success-text">96% on time</span>
          </p>
        </div>
      </div>
    </HoverCardContent>
  </HoverCard>
</p>

Overview

A hover card gives sighted pointer users a look at what is behind a link, such as a carrier, a user or an order, before they follow it. Everything in the card must also be available on the destination page.

When to use

  • To preview a person, company or record that a link points to.
  • In dense tables and activity feeds, where opening every link to check it would be slow.

When not to use

  • To name or explain a control: use a Tooltip.
  • For content the user has to interact with, or that exists nowhere else: use a Popover, which opens on click and works on touch.
  • On triggers that are not links. A hover card is a preview of a destination.

Anatomy

  1. Trigger

    A link. Hovering it for a moment opens the card.

  2. Content

    The floating card, 16rem wide by default. It stays open while the pointer is over it.

Props

The contract every language implements. Names follow each language’s conventions (camelCase in React, snake_case in Rust).

PropTypeDefaultDescription
side"bottom" | "top" | "left" | "right"bottomThe side of the link the card opens on. Set on HoverCardContent.
align"center" | "start" | "end"centerHow the card lines up with the link along that side.
labelstringNorthgate FreightThe link text. Passed as children of HoverCardTrigger.
sideOffsetnumber4Gap between the link and the card, in pixels.
onOpenChangefunction–Called when the card opens or closes. Set on the root.

States

Closed
Only the link is rendered.
Open
Appears after the link has been hovered or focused for a short delay.
Closing
Fades out shortly after the pointer leaves both the link and the card.

Accessibility

KeysAction
TabFocusing the link opens the card; moving focus away closes it.
EnterFollows the link.
EscapeCloses the card.
  • The card is a visual preview and is not announced by screen readers. Do not put information in it that is missing from the destination page.
  • Keyboard focus does not move into the card, so avoid interactive content inside it.
  • Touch devices do not open the card; the link works as a normal link.

Design tokens

Change any of these in Foundations and this component follows, in every language.

Platform notes

HTML / JS
Planned
Not built in HTML / JS yet.
React
Stable
Matches the contract with no platform differences.
React Native
Not available
Touch screens have no hover. Navigate to the detail screen, or open a Popover or bottom sheet on press.
Swift (SwiftUI)
Planned
Not built in Swift yet.
Godot
Planned
Not built in Godot yet.
Vue
Draft
Usage snippet only; same props and behavior as the React component.
Svelte
Draft
Usage snippet only; same props and behavior as the React component.
Solid
Draft
Usage snippet only; same props and behavior as the React component.

Related