Native Solid 2 fork. Original documentation and designs © WorkOS; historical posts retain their original context.
Hover Card
For sighted users to preview content available behind a link.
Features
Can be controlled or uncontrolled.
Customize side, alignment, offsets, collision handling.
Optionally render a pointing arrow.
Supports custom open and close delays.
Ignored by screen readers.
Anatomy
Import all parts and piece them together.
API Reference
Root
Contains all the parts of a hover card.
Trigger
The link that opens the hover card when hovered.
Portal
When used, portals the content part into the body.
Content
The component that pops out when the hover card is open.
Arrow
An optional arrow element to render alongside the hover card. This can be used to help visually link the trigger with the HoverCard.Content. Must be rendered inside HoverCard.Content.
Examples
Show instantly
Use the openDelay prop to control the time it takes for the hover card to open.
Constrain the content size
You may want to constrain the width of the content so that it matches the trigger width. You may also want to constrain its height to not exceed the viewport.
We expose several CSS custom properties such as --radix-hover-card-trigger-width and --radix-hover-card-content-available-height to support this. Use them to constrain the content dimensions.
Origin-aware animations
We expose a CSS custom property --radix-hover-card-content-transform-origin. Use it to animate the content from its computed origin based on side, sideOffset, align, alignOffset and any collisions.
Collision-aware animations
We expose data-side and data-align attributes. Their values will change at runtime to reflect collisions. Use them to create collision and direction-aware animations.
Accessibility
The hover card is intended for sighted users only, the content will be inaccessible to keyboard users.