shadcn.io is not affiliated with official shadcn/ui
Tooltip examples · Content
Tooltip with Icon for React
A Status button whose tooltip pairs a check icon with an all-clear message.
An icon next to the text tells people the kind of message before they read it. This React example opens a Tooltip on a Status button with a check icon beside All systems operational. The tooltip content already lays its children out in a row, so the icon and the text sit side by side with gap-2 between them, and the icon takes the tooltip's text color. Use it for system status, sync state, validation or connection indicators.
Preview
Installation
FAQ
When should I put an icon in the tooltip?
When the mark tells the kind of message before the sentence. This demo puts a CircleCheckIcon beside All systems operational.
What size is the icon in the tooltip?
size-4 on CircleCheckIcon, which lines up with the tooltip's text-xs.
Does the check icon set its own color?
No. It has no color class, so it inherits the tooltip's text color and stays readable on the inverted background.
Why is gap-2 on the tooltip?
The content is a flex row. gap-2 opens a little more space between the check and the sentence, and the row centers them.
gap-2 goes on TooltipContent.
Related
- Simple TooltipAn outline button that shows a one-line
- Tooltip with Title and DescriptionA tooltip with a bold title over a short
- Tooltip with Keyboard ShortcutA Save button whose tooltip names the
- Tooltip with ImageA Preview button whose tooltip shows a
- Tooltip on IconA round icon button with an info icon
- Tooltip PositionsFour buttons whose tooltips open on the