Playground
Change the props and copy the code. The controls come from the component's TypeScript types.
Props
side
delay250
import { Tooltip } from "@/components/ui/tooltip";<Tooltip content="Bold (⌘B)"><Button variant="outline">Hover or focus me</Button></Tooltip>Installation
$ pnpm dlx shadcn@latest add @synccn/tooltipFirst time in this project? Connect synccn with one command.
Usage
import { Tooltip } from "@/components/ui/tooltip";<Tooltip content="Bold"><button>B</button></Tooltip>API reference
Generated from the component's TypeScript types, so it always matches the code.
Tooltip
Shows on hover and keyboard focus after a short delay.
PropTypeDescription
- contentrequired
React.ReactNodeTooltip text.
- side
"top" | "bottom" | "left" | "right"Default
"top"Where it appears.
- delay
numberDefault
250Milliseconds before showing.
- children
React.ReactNodeContent to render.
- className
stringExtra classes for the root element.
Dependencies
Read from the component's imports when the site builds. The CLI installs all of these for you.
Keyboard
- TabFocusing the trigger shows the tooltip
- EscHide it
Accessibility
- Shown on hover and on focus. Don't put essential information or interactive content in a tooltip.
From the source
Read from this component's code when the site builds, so it can't drift.
- ARIA roles: tooltip
- ARIA attributes: aria-describedby
- Keys handled: Escape
More overlays
DialogModal with focus trap, scroll lock and Escape to close.SheetPanel that slides in from the left, right or bottom.Dropdown MenuActions, checkboxes, labels and shortcuts with arrow-key navigation.Context MenuRight-click menu that also opens on long-press.PopoverFloating panel anchored to a trigger.CommandSearchable, grouped command list — the engine behind ⌘K.