shadcn.io is not affiliated with official shadcn/ui
Popover examples · Standard
Compact Popover for React
A small question-mark button that opens a compact popover with a one-line tip.
A question-mark button that opens a panel just wide enough for two words. Use it for a quick hint beside a control, where a full popover would be more frame than content. In React, Base UI handles opening, dismissing and focus.
Preview
Installation
FAQ
Why is this panel only as wide as its text?
PopoverContent sets w-auto and p-2, so the panel hugs the words Quick tip. PopoverTitle uses font-normal and text-xs, and that title is the only text in the panel.
How does the question-mark button become the trigger?
The trigger is a Button with variant="outline", size="sm", and aria-label="Quick tip". Its visible child is ?. Activating it opens the panel.
Pass the button to render on PopoverTrigger, and use PopoverContent as the panel.
Is Quick tip a heading people can see?
Yes. PopoverTitle is the visible text, with font-normal text-xs. The button's aria-label repeats Quick tip, because the button face is only ?.
When is a tooltip a better fit than this panel?
This panel is one short line that stays up until Escape or a click outside. A Tooltip fits a few words on hover or focus. The button here is size="sm".
Related
- Simple Text PopoverA button that opens a popover with a
- Info Icon PopoverAn info icon button that opens a popover
- Simple TooltipAn outline button that shows a one-line
- Badge with Text (Standard)A default badge with a short label for a
- Popover with HeadingA View Details button that opens a
- Button with Text (Standard)The one filled action