structyl

Hover Card API

View component

The full prop reference for the Hover Card component. A rich popover shown when an element receives hover.

Import

tsx
import { HoverCard } from '@structyl/styled';

Props

Root

Wrapper component that manages hover card state and timing

PropTypeDefault
children#React.ReactNode

Content to render inside the hover card root

open#boolean

Controlled open state of the hover card

defaultOpen#boolean

Initial open state when uncontrolled

false
onOpenChange#(open: boolean) => void

Callback fired when the open state changes

openDelay#number

Delay in milliseconds before the card opens on hover

700
closeDelay#number

Delay in milliseconds before the card closes after pointer leaves

300

Trigger

Anchor element that triggers the hover card. Renders as <a> by default, accepts all HTML anchor attributes

PropTypeDefault
asChild#boolean

If true, merges props onto child element instead of rendering as anchor

className#string

CSS class names to apply to the trigger element

Portal

Portal container that renders the hover card content outside the DOM tree

PropTypeDefault
children#React.ReactNode

Content to render in the portal

container#Element | DocumentFragment | null

DOM element where the portal should be rendered (defaults to document.body)

forceMount#boolean

If true, renders content regardless of open state

Content

Styled container for hover card content with positioning and animations

PropTypeDefault
className#string

CSS class names merged with default styled classes

align#'start' | 'center' | 'end'

Vertical alignment of content relative to trigger

'center'
side#'top' | 'right' | 'bottom' | 'left'

Side of the trigger where content should appear

sideOffset#number

Distance in pixels from the trigger element

4
alignOffset#number

Offset in pixels for the alignment position

arrowPadding#number

Padding between arrow and edge of content

avoidCollisions#boolean

If true, adjusts position to avoid viewport collisions

collisionPadding#number

Padding between content and viewport edges when avoiding collisions

asChild#boolean

If true, merges props onto child element instead of rendering as div

forceMount#boolean

If true, renders content regardless of open state

Arrow

SVG arrow pointing from content toward trigger

PropTypeDefault
width#number

Width of the arrow element

height#number

Height of the arrow element

className#string

CSS class names to apply to the arrow

Source code

If you didn't find what you need here, read the component implementation .

structyl — Accessible React Component Library