---
title: "Button Group (BloomButtonGroup) — Bloom UI Primitive"
description: "A connected row of action buttons or toggle selectors with continuous border grouping."
category: "Form Controls"
url: "https://bloom-platform-ten.vercel.app/ui/button-group"
component_name: "BloomButtonGroup"
pub_package: "bloom_ui"
cli_command: "bloom ui add button_group"
last_updated: "2026-08-15"
---

# Button Group (`BloomButtonGroup`)

> A connected row of action buttons or toggle selectors with continuous border grouping.

**Category:** Form Controls  
**Package:** [`bloom_ui`](https://pub.dev/packages/bloom_ui)  
**CLI Install:** `bloom ui add button_group`  
**Web Preview:** [https://bloom-platform-ten.vercel.app/ui/button-group](https://bloom-platform-ten.vercel.app/ui/button-group)

---

## 📦 Installation & Setup

### 1. Using Bloom CLI (Recommended)
Add the source code directly to your project without rigid package locks:
```bash
bloom ui add button_group
```

### 2. Using Pub.dev Package
Add the dependency to your `pubspec.yaml`:
```yaml
dependencies:
  bloom_ui: ^0.1.0
```

### 3. Import in Dart
```dart
import 'package:bloom_ui/bloom_ui.dart';
```

---

## 🚀 Usage Example

```dart
BloomButtonGroup<String>(
  defaultValue: 'week',
  items: const [
    BloomButtonGroupItem(value: 'day', label: Text('Day')),
    BloomButtonGroupItem(value: 'week', label: Text('Week')),
    BloomButtonGroupItem(value: 'month', label: Text('Month')),
  ],
  onChanged: (selected) {
    print('Selected timeframe: $selected');
  },
)
```

---

## 🛠️ API Reference

### Sub-Components & Slots

| Sub-Component | Description |
| :--- | :--- |
| `BloomButtonGroupItem` | Individual item within the segmented group. |
| `BloomButtonGroupSeparator` | Vertical hairline separator between button items. |
| `BloomButtonGroupText` | Styled text block within a button group. |

### Properties & Parameters

| Prop | Type | Default | Description |
| :--- | :--- | :--- | :--- |
| `items` | `List<BloomButtonGroupItem<T>>` | *Required* | List of button items in the group. |
| `defaultValue` | `T?` | *Required* | Initial selected value. |
| `onChanged` | `ValueChanged<T>?` | *Required* | Called when a segmented button is selected. |

---

## 🎨 Theming & Styling

BloomButtonGroup automatically respects the active `BloomTheme` (including `BloomTheme.novaLight`, `BloomTheme.novaDark`, etc.) and responds seamlessly to dark mode changes, custom border radii, and brand color tokens.

### Theme Overrides Example
```dart
Theme(
  data: Theme.of(context).copyWith(
    extensions: [
      context.bloomTheme.copyWith(
        colors: context.bloomColors.copyWith(
          primary: const Color(0xFF8B5CF6), // Custom Purple Accent
        ),
      ),
    ],
  ),
  child: BloomButtonGroup<String>(...,
)
```

---

## 🔗 Related Resources
- [Components Gallery](https://bloom-platform-ten.vercel.app/ui)
- [Bloom Theming & Tokens Guide](https://bloom-platform-ten.vercel.app/docs/theming)
- [Application Blocks Catalog](https://bloom-platform-ten.vercel.app/blocks)
- [Bloom CLI Master Overview](https://bloom-platform-ten.vercel.app/docs/cli)
