Components
- Accordion
- Action Bar
- Alert Dialog
- Alert
- Announcement
- Aspect Ratio
- Autocomplete
- Avatar
- Badge
- Bottom Navigation
- Breadcrumb
- Button Group
- Button
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Circular Progress
- Circular Slider
- Clipboard
- Collapsible
- Color Picker
- Combobox
- Command
- Context Menu
- Data List
- Date Picker
- Dialog
- Drawer
- Editable
- Field
- File Upload
- Float
- Floating Panel
- Frame
- Hint
- Hover Card
- Image Cropper
- Input Group
- Input OTP
- Input
- Item
- Kbd
- Link Overlay
- Listbox
- Marquee
- Menu
- Native Select
- Number Input
- Pagination
- Popover
- Progress
- Prose
- QR Code
- Radio Group
- Rating
- Resizable
- Scroll Area
- Segment Group
- Select
- Separator
- Sheet
- Sidebar
- Signature Pad
- Skeleton
- Skip Nav
- Slider
- Spinner
- Status
- Steps
- Switch
- Table
- Tabs
- Textarea
- Timer
- Toast
- Toggle Group
- Toggle Tooltip
- Toggle
- Tooltip
- Tour
- Tree View
Installation
pnpm dlx shadcn@latest add https://shark.vini.one/r/tooltip.json
Usage
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
<Tooltip> <TooltipTrigger>Hover me</TooltipTrigger> <TooltipContent> {/* Content */} </TooltipContent> </Tooltip>
Tooltip vs Toggle 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 Tooltip when
- The trigger has its own purpose and the popup is supplementary.
- The content is non-essentialānice-to-have clarity for sighted mouse/keyboard users.
- You're okay with touch users not seeing itātooltips only open on hover/focus, not on tap.
- The content is short and non-interactive (no links or buttons inside).
Tooltip behavior
- Hover or focus only ā Opens on hover/focus; touch users cannot access it.
- Non-interactive ā Keep content short with no links or buttons.
- Supplementary ā Best for nice-to-have information, not critical content.
Consider Toggle Tooltip when
- The trigger's primary purpose is to reveal the content.
- The content is essential and should be accessible to touch users and screen readers.
- You need click-to-open so everyone can access it.
- The content may be interactive (links, buttons).
Positioning
Use the positioning prop to change the position of the tooltip.
Examples
With Keyboard Shortcut
Disabled Button
Show a tooltip on a disabled button by wrapping it with a span.
API Reference
Tooltip
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 |
TooltipTrigger
Element that shows the tooltip on hover or focus. Button by default; use asChild for custom elements.
| Prop | Type | Default |
|---|---|---|
asChild | boolean | - |
TooltipContent
Tooltip content shown in a popover on hover or focus.
| Prop | Type | Default |
|---|---|---|
className | string | - |
asChild | boolean | - |
TooltipArrow
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.