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
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.
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
booleanWhether to keep the component mounted after exit.
lazyMount
booleanWhether to enable lazy mounting.
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
700
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