Skip to main content

Starwind UI v3.0 beta is now available! Read the migration guide

Hover Card

Installation

Framework Availability

Astro Available React Available

Hover Card is available for Astro and React.

Usage

General Notes

Hover Card shows additional context when a trigger is hovered or focused, without forcing a click.

The essential components are HoverCard, HoverCardTrigger, and HoverCardContent.

Profile Preview

Use asChild on the trigger when you want to reuse an existing interactive component like Button.

Side and Alignment

Use side, align, and sideOffset on HoverCardContent to control placement.

Non-hoverable Content

By default, moving the pointer from trigger to content keeps the card open. Set disableHoverableContent to close immediately when leaving the trigger.

API Reference

Styled Component API

These props are added or materially changed by the installed Astro styled component. Standard HTML attributes remain available through the inherited interfaces noted below. Follow the Primitive and Runtime links for lower-level behavior props.

Hover Card Trigger

Inherits a attributes.

Contains the following additional props:

Prop Type Default Toggle details
asChild boolean false
Description
Merges the component behavior and props into its child element.
Classification
Primitive override
Primitive prop
preview-card.Trigger.asChild
closeDelay number
Description
Sets the delay in milliseconds before closing.
Classification
Primitive override
Primitive prop
preview-card.Trigger.closeDelay
openDelay number
Description
Sets the delay in milliseconds before opening.
Classification
Primitive override
Primitive prop
preview-card.Trigger.openDelay

Hover Card Content

Inherits div attributes.

Contains the following additional props:

Prop Type Default Toggle details
sideOffset number 4
Description
Sets the distance in pixels between floating content and its anchor.
Classification
Primitive override
Primitive prop
preview-card.Popup.sideOffset

Primitive And Runtime API

Use these references when you need the lower-level behavior APIs behind Hover Card.

Runtime API

Preview Card primitive
createPreviewCard from @starwind-ui/runtime/preview-card

Changelog

v2.0.0

  • Rebuilt Hover Card on Starwind Runtime for hover and focus state, floating placement, and dismissal.
  • See the Preview Card Primitive for the underlying unstyled anatomy and behavior API.