Skip to content

Hover

The Hover component displays content in a card that appears when hovering over a trigger element. It provides a flexible way to show additional information or actions without requiring a click.

import {
Button,
Hover,
} from '@fintech-sandpit/ui/react';
function MyComponent() {
return (
<Hover.Root
positioning={{
placement: 'right',
gutter: 12,
offset: { mainAxis: 0, crossAxis: 0 },
}}
>
<Hover.Trigger asChild>
<Button colorScheme="primary">
Hover me
</Button>
</Hover.Trigger>
<Hover.Content>
<div>
<h3>Hover Card Title</h3>
<p>This is the hover card content.</p>
</div>
</Hover.Content>
</Hover.Root>
);
}
NameTypeRequiredDefaultDescription
openDelaynumber700Delay in milliseconds before opening the hover card
closeDelaynumber300Delay in milliseconds before closing the hover card
openbooleanWhether the hover card is open (controlled)
defaultOpenbooleanfalseWhether the hover card is open by default (uncontrolled)
positioningPositioningOptionsPositioning options for the hover card. See PositioningOptions type below.
NameTypeRequiredDefaultDescription
asChildbooleanfalseWhen true, merges props with the child element instead of rendering a wrapper
NameArgumentsDescription
onOpenChange(details: { open: boolean }) => voidCallback fired when open state changes
type PositioningOptions = {
placement?: 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end'
gutter?: number
offset?: { mainAxis?: number; crossAxis?: number }
}

The root component that manages the hover card state and provides context to child components. Supports both controlled and uncontrolled usage.

The element that triggers the hover card when hovered over. Use asChild prop to merge props with a child element.

The main content container for the hover card. Automatically includes positioning and portal rendering.