shadcn.io is not affiliated with official shadcn/ui
Popover examples · Standard
User Profile Popover for React
A username button that opens a popover with the person's name, handle and role.
A ghost @username button that opens the person's name, handle and role. Show who someone is without leaving the page; for a preview on hover, use a Hover Card. In React, Base UI handles opening, dismissing and focus.
Preview
Installation
FAQ
What does the profile panel show?
PopoverHeader holds PopoverTitle reading John Doe and PopoverDescription reading @username. Under that, a p with text-xs says Software Developer. The trigger label is @username.
How does the username button open the panel?
The trigger is a Button with variant="ghost" and the label @username. Pressing it, or using Enter or Space, opens the panel. For a preview that opens when the pointer rests on a name, use a Hover Card.
Pass the button to render on PopoverTrigger, and use PopoverContent as the panel.
Which text styles separate the name, handle, and role?
The name is PopoverTitle. The handle is PopoverDescription, inside PopoverHeader. The role is a separate p with className="text-xs".
How wide is the profile panel?
PopoverContent has no width class, so it keeps w-72. The content is the header plus the one-line role.
Related
- Popover with HeadingA View Details button that opens a
- Popover with DividerA popover whose two sections are split by
- Standard CardA basic card with a title, a description
- Avatar StandardA round avatar with a profile picture and
- Badge with Text (Standard)A default badge with a short label for a
- Simple TooltipAn outline button that shows a one-line