Group Buttons a series of buttons together on a single line, use to toggle content.
Button group example below.
If need to disable certain button, add to the preferred <base-group-button-item> the attribute disabled="true".
Add base-icon with preferred name inside <base-group-button-item>
Use the size property to change the height of the button group. Available sizes match our standard buttons: 'sm' | 'default' | 'lg' | 'xl' | 'xxl'.
Run the following command to add this component to your project:
npx base-ui-cli add button-group
For AI agents
Copy a prompt with the registry name, CLI install, and import — or add the Base UI MCP server.
npx -y base-ui-mcp
Base UI provides standalone components. Import the exact elements you want to use into your component.
// Install: npx base-ui-cli add button-group
// Paths are relative to aliases.components (default: src/app/components)
import { ButtonGroupComponent } from './button-group/button-group.component';
import { ButtonGroupParent } from './button-group/button-group.token';
import { GroupButtonComponent } from './button-group/group-button/group-button.component';
import { ToggleButtonService, ToggleGroupButton } from './button-group/toggle-button.service';
@Component({
selector: 'app-your-component',
imports: [
ButtonGroupComponent,
GroupButtonComponent
],
template: `...`
})
export class YourComponent {
private toggleButton = inject(ToggleButtonService);
} API for button-group — generated from JSDoc in the library source.
| API | Member | Type | Default | Description |
|---|---|---|---|---|
ToggleButtonService | setSelectedButton() | (value: ToggleGroupButton) => void | — | Calls setSelectedButton. |
ButtonGroupParent | size | Signal<GroupButtonSize> | — | — |
ToggleGroupButton | active | WritableSignal<boolean> | — | — |
base-button-group | class | string | '' | Additional host CSS classes (merged via cn()). |
base-button-group | size | GroupButtonSize | 'default' | Shared size for all items in the group. Matches button / icon-button heights (`sm` = 28px, `default` = 36px, etc.). |
base-button-group | (valueChange) | void | — | Emits when valueChange occurs. |
base-group-button-item | class | string | '' | Additional host CSS classes (merged via cn()). |
base-group-button-item | icon | string | undefined | undefined | — |
base-group-button-item | disabled | boolean | false | — |
base-group-button-item | value | unknown | undefined | — |
base-group-button-item | size | GroupButtonSize | undefined | undefined | Optional size override. When omitted, inherits from the parent `base-button-group`. |
Content