shadcn.io is not affiliated with official shadcn/ui
Popover examples · Standard
Popover with List for React
A View Items button that opens a popover listing three items.
A View Items button that opens a short list of three rows. Use it to show a handful of related entries next to the control that counts them. In React, Base UI handles opening, dismissing and focus.
Preview
Installation
FAQ
How is the list marked up?
The items are the strings Item 1, Item 2, and Item 3, mapped into li elements. The list is a ul with flex flex-col gap-2. PopoverTitle reads Items and has className="sr-only".
How does View Items become the trigger?
The trigger is a Button with variant="outline" and the label View Items. Activating it opens the panel. The three strings live in an items array outside the component.
Pass the button to render on PopoverTrigger, and use PopoverContent as the panel.
What does a row contain?
Each row is an li with text. gap-2 on the ul is the space between Item 1, Item 2, and Item 3. This file leaves the rows as text.
What names the list panel?
PopoverTitle is Items, with className="sr-only". The button says View Items. The visible content is the three list rows.
Related
- Popover with ActionsA popover with Edit, Share and Delete
- Simple Dropdown with Icons Dropdown MenuA short menu behind a dots button with an
- Notifications PopoverA bell button with an unread count that
- Simple Single Select ComboboxA single-select combobox that opens from
- Simple Command MenuAn inline command menu with a search
- Compact PopoverA small question-mark button that opens a