Tooltip provider
In code: TooltipProvider
A part of Tooltip: use it inside one.
Kept so older code still works: tooltips now open at once after the first by themselves
Preview
Edit
Duplicate
Share
Delete
Use
The code of the preview above
import { Button, Row, Tooltip } from '@/components/ui';
import { Copy, Pencil, Share2, Trash2 } from 'lucide-react';
<Row gap={1}>
<Tooltip content="Edit">
<Button icon variant="ghost" aria-label="Edit"><Pencil /></Button>
</Tooltip>
<Tooltip content="Duplicate">
<Button icon variant="ghost" aria-label="Duplicate"><Copy /></Button>
</Tooltip>
<Tooltip content="Share">
<Button icon variant="ghost" aria-label="Share"><Share2 /></Button>
</Tooltip>
<Tooltip content="Delete">
<Button icon variant="ghost" aria-label="Delete"><Trash2 /></Button>
</Tooltip>
</Row>Options
| Option | Type | What it does |
|---|---|---|
children | ReactNode | What goes inside. |
Without React
With the CSS in parts (/ui/css/), it needs these, besides the ones every page loads:
components/card.csscomponents/popups.csscomponents/tooltip.csscomponents/prose.cssparts/board.cssOn top of the page: states, do and don’t
States. Closed, opening (fades and rises), open, closing (fades before what it changed appears: afterClose). While open, focus is inside and Escape closes it; when it closes, focus goes back to what opened it.
Do
- Name every dialog, drawer and popover (
DialogTitle,DrawerTitle, oraria-label). - Use
AlertDialogfor anything that cannot be undone, with the action named on its button ("Delete 3 files"). - Use a
Draweron a phone for what aPopoverdoes on a computer.
Don't
- Don't open a dialog from a dialog; change what the open one shows instead.
- Don't put the only way to do something in a right-click menu or a tooltip.
- Don't use a toast for something the person must not miss: that is an
Alerton the page.