A short hint shown on hover or keyboard focus.
$ pnpm dlx shadcn@latest add https://dashral.com/r/tooltip.jsonInstallation
$ pnpm dlx shadcn@latest add https://dashral.com/r/tooltip.jsonAdds the component, the components it builds on, its npm packages and the theme tokens it uses. Using Dashral often? Add the registry to components.json once:
components.json
{
"registries": {
"@dashral": "https://dashral.com/r/{name}.json"
}
}Then add components by name:
$ pnpm dlx shadcn@latest add @dashral/tooltipUsage
example.tsx
import { Link2 } from "lucide-react"
import { Button } from "@/components/dashral/button"
import { Tooltip } from "@/components/dashral/tooltip"
<Tooltip content="Copy link">
<Button size="icon" variant="ghost" aria-label="Copy link">
<Link2 />
</Button>
</Tooltip>Examples
API reference
Tooltip
Also takes every prop of Radix Tooltip(opens in a new tab).
| Prop | Type | Default |
|---|---|---|
content | ReactNodeWhat it says. Required. | — |
children | ReactElementThe control it describes; it must take a ref and focus. | — |
side / align | Where it shows. | "top" / "center" |
delay | numberMilliseconds the pointer rests before it opens. | 0 |
className | stringThe tooltip's classes. | — |
Keyboard
| Keys | Action |
|---|---|
| Tab | Focusing the trigger shows it |
| Escape | Hide it |
Accessibility
- Describes the trigger (aria-describedby). Only for short hints: no links or buttons inside, and never the only label of an icon button — give that an aria-label too.
Motion
- Opens with a fade, a scale from 95%, a 2px blur clearing and a 4px slide from its trigger's side, on the spring (--duration-standard); closes faster (--duration-fast, --ease-exit). No blur with reduced motion.