shadcn.io is not affiliated with official shadcn/ui
Button Group examples · Actions
Social Actions Button Group for React
Like, Comment and Share in one button group, with labels and as an icon-only row.
The engagement row under a post. The labeled group spells out Like, Comment and Share; the icon-only group is the compact version for feeds, with an aria-label on each button so the actions still have names.
Preview
Installation
FAQ
What is in the labeled row?
Like, Comment and Share, each with an icon, size="sm" and variant="outline". The second group repeats the same three icons with no visible text.
How are the icon-only buttons named?
Each Button in the second group has an aria-label, Like, Comment or Share, and size="icon-sm". The icons have aria-hidden="true".
How do I show that a post is liked?
Keep a liked flag, switch that button's variant to default and set aria-pressed. The Like with Count example shows the liked state.
How do I add the number of likes?
Put a ButtonGroupText after the button with the count, as in Like with Count. This demo shows no counts.
Related
- Like with Count Button GroupA like button joined to its count, shown
- Comment Actions Button GroupReply, Edit, Delete and Report as ghost
- Messages and Followers Button GroupA Messages button with a red unread
- Basic Button GroupThree rows of outline buttons joined into
- Badge with Icon on Left (Standard)A default badge with a star icon before
- Bulk Actions Button GroupA row of bulk actions, Select All