shadcn.io is not affiliated with official shadcn/ui
Button Group examples · Standard
Vertical Button Group for React
Two vertical button groups that stack outline buttons from top to bottom with shared borders.
The same join as a horizontal group, turned on its side. orientation="vertical" stacks the buttons, rounds only the top and bottom corners, and shares the border between each pair. Use it for a short list of options in a narrow column or a side panel.
Preview
Installation
FAQ
How do I stack the buttons?
Set orientation to vertical on ButtonGroup. The group switches to a column and rounds the top and bottom of the stack instead of the left and right ends.
What do the two groups show?
Top, Middle and Bottom at the default size, and Option 1 to Option 4 with size set to sm. They sit side by side with gap-4.
Why are the buttons in a column the same width?
The group stretches its children, so each button fills the column's width. The widest label sets it.
Do the options do anything?
No. They are static labels. Add a click handler on each Button, or switch the variant of the chosen one to show a selection.
Related
- Basic Button GroupThree rows of outline buttons joined into
- Button Group VariantsTwo outline button groups of editing
- Keyboard Shortcuts Button GroupCopy, Save and Export buttons that show
- Simple Navigation Navigation MenuA navigation menu with Products and
- Button with Text (Outline)A border, no fill
- Nested Button GroupsButton groups nested inside a parent