Skip to content

Tooltip

The Tooltip component displays a contextual hint that appears when hovering over a trigger element. It provides a simple way to show additional information without requiring a click.

import {
Button,
Tooltip,
} from '@fintech-sandpit/ui/react';
function MyComponent() {
return (
<Tooltip.Root
positioning={{
placement: 'top',
}}
>
<Tooltip.Trigger asChild>
<Button colorScheme="primary">
Hover me
</Button>
</Tooltip.Trigger>
<Tooltip.Content>
This is a tooltip message
</Tooltip.Content>
</Tooltip.Root>
);
}
NameTypeDefaultDescription
openbooleanWhether the tooltip is open (controlled)
defaultOpenbooleanfalseWhether the tooltip is open by default (uncontrolled)
positioningPositioningOptionsPositioning options for the tooltip. See PositioningOptions type below.
NameTypeDefaultDescription
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 tooltip state and provides context to child components. Supports both controlled and uncontrolled usage.

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

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