GitHub

Hover Card

A card that appears when a user hovers over an element.

Installation

Usage

Triggers Delays

The openDelay and closeDelay props control the delay before the hover card opens and closes respectively.

Default values are 100ms for closeDelay and 10ms for openDelay.

Positioning

Control the position of the hover card relative to the trigger using the positioning prop.

API Reference

HoverCard

Root element of the hover card component. Renders a div.

HoverCardTrigger

Button that triggers the hover card. Renders a button.

Attributes:

  • [data-scope] - hover-card
  • [data-part] - trigger
  • [data-placement] - The placement of the trigger
  • [data-state] - "open" | "closed"

HoverCardContent

Content element that displays when the hover card is open. Renders a div.

Attributes:

  • [data-scope] - hover-card
  • [data-part] - content
  • [data-state] - "open" | "closed"
  • [data-nested] - popover
  • [data-has-nested] - popover
  • [data-placement] - The placement of the content

CSS Variables:

  • --layer-index - The index of the dismissable in the layer stack
  • --nested-layer-count - The number of nested hover-cards

HoverCardArrow

Arrow element that points to the trigger. Renders a div.

CSS Variables:

  • --arrow-size - The size of the arrow
  • --arrow-size-half - Half the size of the arrow
  • --arrow-background - Use this variable to style the arrow background
  • --arrow-offset - The offset position of the arrow

HoverCardArrowTip

Tip of the arrow element. Renders a div.


For a complete list of props, see the Ark UI documentation.