Preview Card

A floating card that surfaces contextual information when hovering over a trigger, such as user profiles, link previews, or supplementary details.

Overview

The PreviewCard component surfaces glanceable, contextual information when the user hovers over a trigger element. It's designed for supplementary content like user profiles, link destinations, or metadata — information that helps the user decide whether to take further action.

Usage

import { PreviewCard, PreviewCardTrigger, PreviewCardContent } from "@tilt-legal/cubitt-components/primitives";
<PreviewCard>
  <PreviewCardTrigger render={<a href="/profile" />}>
    Jane Smith
  </PreviewCardTrigger>
  <PreviewCardContent>
    <p>Preview content goes here</p>
  </PreviewCardContent>
</PreviewCard>

Examples

Basic

Hover over the name to see a preview of user information.

Positions

Preview card positioned on different sides of the trigger.

With Badges

Hover to see a richer profile preview with skills and metadata.

Preview card triggered by a text link.

API Reference

PreviewCard

The root component that manages the preview card state.

PropTypeDefaultDescription
openbooleanWhether the preview card is currently open (controlled).
defaultOpenbooleanfalseWhether the preview card is initially open (uncontrolled).
onOpenChange(open: boolean) => voidCallback fired when the preview card is opened or closed.
onOpenChangeComplete(open: boolean) => voidCallback fired after any open/close animations complete.
actionsRefRefObjectReference to imperative actions for manual unmounting.
childrenReactNodeChild elements of the preview card.

PreviewCardTrigger

The element that shows the preview card when hovered.

PropTypeDefaultDescription
delaynumber0Delay in milliseconds before showing the preview.
closeDelaynumber0Delay in milliseconds before hiding the preview.
childrenReactNodeThe content of the trigger element.
classNamestring | (state) => stringCSS classes or function that returns classes based on component state.
renderReactElement | (props) => ReactElementAllows composing the trigger with another component. Receives props to spread.

PreviewCardContent

The container for the preview card content, positioned relative to the trigger.

PropTypeDefaultDescription
classNamestringAdditional CSS classes for the content.
align"start" | "center" | "end""center"Alignment relative to the trigger.
side"top" | "right" | "bottom" | "left""bottom"Which side of the trigger to position.
sideOffsetnumber8Distance in pixels from the trigger.
alignOffsetnumber0Offset in pixels along the alignment axis.
childrenReactNodeThe content to display inside the preview card.

On this page