| title | Tooltip |
|---|---|
| description | A popup that displays information related to an element when it receives keyboard focus or the mouse hovers over it. |
| source | packages/raystack/components/tooltip |
import { playground, sideDemo, alignDemo, customDemo, providerDemo, trackCursorDemo, arrowDemo } from "./demo.ts";
Import and assemble the component:
import { Tooltip } from "@raystack/apsara";
<Tooltip.Provider>
<Tooltip />
</Tooltip.Provider>The Tooltip component accepts various props to customize its behavior and appearance. You can use it either as a standalone component or nested within a TooltipProvider for enhanced functionality.
The Trigger component wraps the element that activates the tooltip.
The Content component displays the tooltip content and controls positioning.
The Provider component serves as a context wrapper that provides global configuration and functionality to all tooltip instances within your application.
The Tooltip Content component can be positioned in different directions using the side prop:
The Tooltip Content component can be aligned in different directions using the align prop:
Tooltips can contain custom content using ReactNode:
The TooltipProvider component can be used to provide a global configuration for all tooltips in your application.
Use trackCursorAxis prop on the Root component to make the tooltip follow the cursor:
Show the arrow by setting showArrow={true} on the Content component:
- Respects motion preferences: tooltip entry motion is enabled only when
prefers-reduced-motion: no-preference