indiacn
uibutton-groupsource: ok · hit
Button Group
Groups related buttons horizontally or vertically with shared borders.
npx shadcn add "https://indiacn.in/r/button-group.json"free
No selection tags yet — empty means no evidence, not lack of support.
Dependencies
Bundle weight · lightRegistry dependencies
https://indiacn.in/r/theme.jsonhttps://indiacn.in/r/button.json
Files1 · source cached 10/9/2026, 1:28:10 PM
components/ui/button-group.tsx
import { ComponentProps } from 'react';
import { cn } from '@/lib/utils';
interface IButtonGroupProps extends ComponentProps<'div'> {
orientation?: 'horizontal' | 'vertical';
}
/** Group of related buttons displayed together. */
function ButtonGroup({ className, orientation = 'horizontal', ...props }: IButtonGroupProps) {
return (
<div
role='group'
className={cn(
'inline-flex',
orientation === 'horizontal'
? '*:rounded-none [&>*:first-child]:rounded-l-md [&>*:last-child]:rounded-r-md [&>*:not(:first-child)]:-ml-px'
: 'flex-col *:rounded-none [&>*:first-child]:rounded-t-md [&>*:last-child]:rounded-b-md [&>*:not(:first-child)]:-mt-px',
className,
)}
{...props}
/>
);
}
/** Toolbar container for button groups. */
function ButtonToolbar({ className, ...props }: ComponentProps<'div'>) {
return (
<div role='toolbar' className={cn('flex flex-wrap items-center gap-2', className)} {...props} />
);
}
export { ButtonGroup, ButtonToolbar };