id: toggle_group
label: Toggle Group
family: family-c-forms
category: Action
intent: Group of toggle buttons with single or multiple selection
description: Group of toggle buttons
composable: true
capabilities: Multiple, Disabled
required_parts: []
optional_parts: []
tags: ["toggle-group", "toggle", "group", "buttons", "options", "selection"]
keywords:
pain: Grouped toggles lack exclusivity and shared disabled state
promise: Group behavior and selection mode enforced structurally
why: |
ToggleGroupPrimitive encodes multiple selection and disabled state at container level. Child toggles inherit behavior. This guarantees consistent grouped interactions.
rules: ["CR-001", "CR-004"]
use_cases: ["toolbars", "option groups"]
related: ["switch", "toggle"]
file: toggle_group_ui.css
tokens: toggle-group-*, toggle-*, space-*, radius-*
foundation: spacing, radius
states: ["on", "off", "disabled"]
island: toggle_group_boundary.rs
pillar: toggle
badges: ["SSR Safe", "Hydration Safe", "Token Driven", "Deterministic API", "Zero Drift", "Island Architecture"]
before: |
// ❌ Typical
view! {
<div>
<button>"A"</button>
<button>"B"</button>
</div>
}
after: |
// ✅ CanonRS
view! {
<ToggleGroup multiple=false>
<Toggle>"A"</Toggle>
</ToggleGroup>
}
boundary_type: interaction
ix_group: ix_selection
block: []
blocks_primitives: [flex, stack]