Preview Card

A popup that appears when a link is hovered, showing a preview for sighted users.

The principles of good typography remain into the digital age.

API reference

Import the component and place its parts the following way:

Anatomy
import { PreviewCard } from '@base-ui-components/react/previewCard';

<PreviewCard.Root>
  <PreviewCard.Trigger />
  <PreviewCard.Portal>
    <PreviewCard.Backdrop />
    <PreviewCard.Positioner>
      <PreviewCard.Popup>
        <PreviewCard.Arrow />
      </PreviewCard.Popup>
    </PreviewCard.Positioner>
  </PreviewCard.Portal>
</PreviewCard.Root>

Root

Groups all parts of the preview card. Doesn’t render its own HTML element.

PropTypeDefault
closeDelaynumber300
defaultOpenbooleanfalse
delaynumber600
onOpenChange(open, event, reason) => voidundefined
openbooleanundefined

Trigger

A link that opens the preview card. Renders an <a> element.

PropTypeDefault
classNamestring | (state) => stringundefined
render| React.ReactElement
| (props, state) => React.ReactElement
undefined

Portal

A portal element that moves the popup to a different part of the DOM. By default, the portal element is appended to the <body>.

PropTypeDefault
containerReact.Ref | HTMLElement | nullundefined
keepMountedbooleanfalse

Backdrop

An overlay displayed beneath the popup. Renders a <div> element.

PropTypeDefault
classNamestring | (state) => stringundefined
keepMountedbooleanfalse
render| React.ReactElement
| (props, state) => React.ReactElement
undefined

Positioner

Positions the popup against the trigger. Renders a <div> element.

PropTypeDefault
align'start' | 'center' | 'end''center'
alignOffsetnumber0
anchor| React.Ref
| Element
| VirtualElement
| (() => Element
| VirtualElement
| null)
| null
undefined
arrowPaddingnumber5
classNamestring | (state) => stringundefined
collisionBoundary| 'clippingAncestors'
| Element
| Element[]
| Rect
'clipping-ancestors'
collisionPaddingnumber | Rect5
keepMountedbooleanfalse
positionMethod'absolute' | 'fixed''absolute'
render| React.ReactElement
| (props, state) => React.ReactElement
undefined
side| 'bottom'
| 'inline-end'
| 'inline-start'
| 'left'
| 'right'
| 'top'
'bottom'
sideOffsetnumber0
stickybooleanfalse
CSS VariableType
--anchor-heightnumber
--anchor-widthnumber
--available-heightnumber
--available-widthnumber
--transform-originstring

A container for the preview card contents. Renders a <div> element.

PropTypeDefault
classNamestring | (state) => stringundefined
render| React.ReactElement
| (props, state) => React.ReactElement
undefined

Arrow

Displays an element positioned against the preview card anchor. Renders a <div> element.

PropTypeDefault
classNamestring | (state) => stringundefined
render| React.ReactElement
| (props, state) => React.ReactElement
undefined