A component that displays additional information when hovering over an element
Anatomy
Usage
<script> import {HoverCard, Portal} from 'ui-ingredients';</script><HoverCard.Root> <HoverCard.Trigger>Hover me</HoverCard.Trigger> <Portal> <HoverCard.Positioner> <HoverCard.Content> <HoverCard.Arrow> <HoverCard.ArrowTip /> </HoverCard.Arrow> Lorem ipsum dolor sit amet consectetur adipisicing elit. Sed omnis natus neque, tenetur praesentium laboriosam esse eius at maxime quam magni rerum animi ducimus debitis? </HoverCard.Content> </HoverCard.Positioner> </Portal></HoverCard.Root>
API Reference
Root
Prop
Default
Description
animateOnMount
true
booleanWhether to run the enter animation when the component mounts.
closeDelay
300
numberThe duration from when the mouse leaves the trigger or content until the hover card closes.
defaultOpen
booleanThe initial open state of the hover card when rendered.
Use when you don't need to control the open state of the hover card.
disabled
booleanWhether the hover card is disabled
id
stringThe unique identifier of the machine.
ids
{
trigger?: string;
content?: string;
positioner?: string;
arrow?: string;
}The ids of the elements in the popover. Useful for composition.
keepMounted
true
booleanWhether to keep the component mounted after exit.
lazyMount
false
booleanWhether to enable lazy mounting.
onExitComplete
() => voidCallback that fires when the exit animation of the dialog completes.
onFocusOutside
(event: FocusOutsideEvent) => voidFunction called when the focus is moved outside the component
onInteractOutside
(event: InteractOutsideEvent) => voidFunction called when an interaction happens outside the component
onOpenChange
(details: OpenChangeDetails) => voidFunction called when the hover card opens or closes.
onPointerDownOutside
(event: PointerDownOutsideEvent) => voidFunction called when the pointer is pressed down outside the component
open
booleanThe controlled open state of the hover card
openDelay
600
numberThe duration from when the mouse enters the trigger until the hover card opens.
positioning
PositioningOptionsThe user provided options used to position the popover content