Button Group
indiacn/button-groupFreeComponent
Groups related buttons horizontally or vertically with shared borders.
Install it
npx shadcn@latest add https://indiacn.in/r/button-group.jsonSource
1import { ComponentProps } from 'react';23import { cn } from '@/lib/utils';45interface IButtonGroupProps extends ComponentProps<'div'> {6 orientation?: 'horizontal' | 'vertical';7}89/** Group of related buttons displayed together. */10function ButtonGroup({ className, orientation = 'horizontal', ...props }: IButtonGroupProps) {11 return (12 <div13 role='group'14 className={cn(15 'inline-flex',16 orientation === 'horizontal'17 ? '*:rounded-none [&>*:first-child]:rounded-l-md [&>*:last-child]:rounded-r-md [&>*:not(:first-child)]:-ml-px'18 : 'flex-col *:rounded-none [&>*:first-child]:rounded-t-md [&>*:last-child]:rounded-b-md [&>*:not(:first-child)]:-mt-px',19 className,20 )}21 {...props}22 />23 );24}2526/** Toolbar container for button groups. */27function ButtonToolbar({ className, ...props }: ComponentProps<'div'>) {28 return (29 <div role='toolbar' className={cn('flex flex-wrap items-center gap-2', className)} {...props} />30 );31}3233export { ButtonGroup, ButtonToolbar };
What it pulls in
Other registry items
Files it writes
More from indiacn
All 26 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | indiacn | Components | Free | 2 deps | |
| Alertalert | indiacn | Components | Free | 2 deps | |
| Badgebadge | indiacn | Components | Free | 1 dep | |
| Breadcrumbbreadcrumb | indiacn | Components | Free | 1 dep | |
| Buttonbutton | indiacn | Components | Free | 3 deps | |
| Cardcard | indiacn | Components | Free | 1 dep | |
| Chipchip | indiacn | Components | Free | 2 deps | |
| Collapsecollapse | indiacn | Components | Free | 1 dep |
