docs/components/tooltip
Sections
Components
Utilities
Forms
Hooks
Copy Markdown
Display information on hover or focus.
PreviewCode
CLIManual
pnpmbunnpmyarn
pnpm dlx shadcn@latest add @shark/tooltip
Tooltip
├── TooltipTrigger
└── TooltipContent
import {
Tooltip,
TooltipContent,
TooltipTrigger
} from "@/components/ui/tooltip";
<Tooltip>
<TooltipTrigger>Hover me</TooltipTrigger>
<TooltipContent>
</TooltipContent>
</Tooltip>
You're viewing Tooltip —a label that shows on hover or focus. Use it when the content is supplementary and non-essential, and you're okay with touch users not having access.
Use the positioning prop to change the position of the tooltip.
PreviewCode
lefttopbottomright
PreviewCode
Add to library
Show a tooltip on a disabled button by wrapping it with a span.
PreviewCode
Disabled
Root component that wraps the tooltip. Manages open state and positioning.
| Prop | Type | Default |
|---|---|---|
positioning | PositioningOptions | { placement: "top" } |
openDelay | number | 0 |
closeDelay | number | 100 |
lazyMount | boolean | true |
unmountOnExit | boolean | true |
open | boolean | - |
defaultOpen | boolean | - |
onOpenChange | (details: OpenChangeDetails) => void | - |
disabled | boolean | - |
interactive | boolean | false |
closeOnClick | boolean | true |
closeOnEscape | boolean | true |
closeOnPointerDown | boolean | true |
closeOnScroll | boolean | true |
Element that shows the tooltip on hover or focus. Button by default; use asChild for custom elements.
| Prop | Type | Default |
|---|---|---|
asChild | boolean | - |
Tooltip content shown in a popover on hover or focus.
| Prop | Type | Default |
|---|---|---|
className | string | - |
asChild | boolean | - |
Optional arrow pointing to the trigger. Place inside TooltipContent.
| Prop | Type | Default |
|---|---|---|
asChild | boolean | - |
| Attribute | Default |
|---|---|
--arrow-background | var(--foreground) |
--arrow-size | calc(1.5 * var(--spacing)) |
For a complete list of props, see the Ark UI documentation.
[
Previous page
Toggle ](/docs/components/toggle)[
Next page
Tour ](/docs/components/tour)
On This Page
InstallationAnatomyUsageTooltip vs Toggle TooltipUse Tooltip whenTooltip behaviorConsider Toggle Tooltip whenPositioningExamplesWith Keyboard ShortcutDisabled ButtonAPI ReferenceTooltipTooltipTriggerTooltipContentTooltipArrow