Default
Show the codeHide the code
Default, code
<TooltipTrigger><Button variant="outline">Copy link</Button><Tooltip {...args} /></TooltipTrigger>A short text description of a control, shown on focus and hover, hoverable, dismissed with Esc.
These are the real React components. Use them with a mouse, touch or keyboard, and switch the theme and density for every example at once.
Default, code
<TooltipTrigger><Button variant="outline">Copy link</Button><Tooltip {...args} /></TooltipTrigger>Open, code
<TooltipTrigger defaultOpen><Button variant="outline">Copy link</Button><Tooltip {...args} /></TooltipTrigger>Placements, code
<div className="flex flex-wrap gap-gap-lg py-12">
{(['top', 'bottom', 'start', 'end'] as const).map((p) => <TooltipTrigger key={p} defaultOpen={p === 'bottom'}><Button variant="outline">{p}</Button><Tooltip placement={p}>Opens {p}</Tooltip></TooltipTrigger>)}
</div>The 5 design tokens Tooltip reads, with the value each has in the theme and density chosen above. Change a token and the component follows, in Figma and in code.
| Token | Value now | CSS variable |
|---|---|---|
| elevation.2 | … | --sd-elevation-2 |
| layer.tooltip | … | --sd-layer-tooltip |
| tooltip.bg | … | --sd-tooltip-bg |
| tooltip.fg | … | --sd-tooltip-fg |
| tooltip.radius | … | --sd-tooltip-radius |
The npm package isn’t published yet. When it is, this is the install line; until then, this page runs the same build of the package (from commit fa3abf8).
Install
npm i @superduperui/react @superduperui/tokensImport
import { Tooltip, TooltipTrigger } from "@superduperui/react"Tooltip also takes the props of the React Aria component it’s built on.
| Prop | Type | What it does |
|---|---|---|
childrenrequired | ReactNode | Short, plain text. Never the only place information lives, never interactive content. |
placement | unknownDefault 'top' | |
offset | unknownDefault 8 |
Screen readers announce "Copy link, button, Copies the link to your clipboard".
WCAG 2.2 AAA criteria the component meets in Comfortable density: 1.4.6, 1.4.9, 2.1.3, 2.3.2, 2.4.13, 2.5.5, 2.5.6.
Compact density meets AA (2.5.8, 24px targets), not AAA.
Shared patterns it ships with: 1.4.13 (hoverable, persistent, dismissable).
| axe-core (WCAG A, AA, AAA and best practice) | 80 runs across every story, theme, density and width: 0 violations |
|---|---|
| Rendered text contrast | 95 text runs: 0 below 7:1, lowest 16.71:1 |
| Target size | 12 targets: 0 under 44px in Comfortable |
| Focus appearance (2.4.13) | 18 focus stops in 3 browser engines: all pass |
| Keyboard script | Chromium 2 of 2, Firefox 2 of 2, WebKit 2 of 2 |
Manual passes with VoiceOver and NVDA haven’t been done yet.
Each step is scripted and run in Chromium, Firefox and WebKit.
| Key | What happens |
|---|---|
| Tab | Focus opens the tooltip at once |
| Escape | Esc dismisses it without moving focus (1.4.13) |
The Figma component is Tooltip, with Placement (Top, Bottom, Start, End); Length (Short, Long). The Figma library isn’t published yet.
Figma to code: Placement → placement (Top = "top", Bottom = "bottom", Start = "start", End = "end"); Text → children; Length (Short, Long; preview only).