---
title: "चेकबॉक्स ग्रुप"
description: "ऐसा एक सवाल पूछता है जिसके, एक साथ दिखाए गए थोड़े-से विकल्पों में से, कई जवाब हो सकते हैं — एक लेबल के नीचे चेकबॉक्स का एक सेट, एक विवरण और एक त्रुटि के साथ, जो चेक किए गए मानों की लिस्ट एक नाम से रखता है और ऐसा चेकबॉक्स साथ ला सकता है जो उन सबको चेक कर देता है।"
url: "https://tanrei.chnotchy.com/hi/components/checkbox-group/"
last_updated: 2026-10-23T21:17:12.000Z
---

# चेकबॉक्स ग्रुप

> ऐसा एक सवाल पूछता है जिसके, एक साथ दिखाए गए थोड़े-से विकल्पों में से, कई जवाब हो सकते हैं — एक लेबल के नीचे चेकबॉक्स का एक सेट, एक विवरण और एक त्रुटि के साथ, जो चेक किए गए मानों की लिस्ट एक नाम से रखता है और ऐसा चेकबॉक्स साथ ला सकता है जो उन सबको चेक कर देता है।

## अवलोकन

चेकबॉक्स ग्रुप वहाँ इस्तेमाल करें जहाँ एक सवाल का जवाब एक लिस्ट है और विकल्प इतने कम हैं कि सब एक साथ दिखाए जा सकें, ज़्यादा से ज़्यादा सात के आसपास: सूचना पाने के तरीक़े, वे दिन जब रिपोर्ट भेजी जाती है, वे प्रकार जिनसे कोई लिस्ट फ़िल्टर होती है। जवाब एक ही मान है, यानी चेक किए गए मानों की लिस्ट, और फ़ॉर्म उसे एक नाम से सबमिट करता है।

**किनसे बना है:** एक [फ़ील्ड ग्रुप](https://tanrei.chnotchy.com/hi/components/field-group/) और [चेकबॉक्स](https://tanrei.chnotchy.com/hi/components/checkbox/) से। फ़ील्ड ग्रुप फ़्रेम है: लेबल, ज़रूरी या वैकल्पिक का निशान, विवरण, त्रुटि, और कॉलम या पंक्ति का लेआउट। मान चेकबॉक्स रखते हैं: हर एक अपने लेबल वाला एक विकल्प है, और उनमें से कौन-से चेक किए गए हैं, वही लिस्ट है। चेकबॉक्स ग्रुप अपना कुछ नहीं बनाता और उसका कोई टोकन नहीं है। वह इन दोनों में वह स्टेट जोड़ता है जो वरना हर प्रॉडक्ट ख़ुद लिखता है: लिस्ट और उसके लिए एक `change`, फ़ॉर्म में एक नाम, रीसेट के साथ और फ़ॉर्म के अपने इस वैलिडेशन के साथ कि ज़रूरी सेट ख़ाली नहीं है, और सबको चेक करने वाले चेकबॉक्स के तीन स्टेट।

यह उतना ही चौड़ा है जितनी वह जगह जिसमें इसे रखा गया है।

वेब पर यह `<tanrei-checkbox-group>` है। बाक़ी प्लैटफ़ॉर्म ने इसे अभी इम्प्लीमेंट नहीं किया है।

### इस्तेमाल

हर चेकबॉक्स वह विकल्प है जिसका नाम उसका `value` है। ग्रुप का `value` चेक किए गए मानों की लिस्ट है, चेकबॉक्स के क्रम में। लिस्ट का जो मान किसी चेकबॉक्स का नहीं है, वह रखा रहता है: जिन विकल्पों को किसी खोज ने नज़र से हटा दिया है, वे चुने हुए रहते हैं।

**Web**

```html
<form>
  <tanrei-checkbox-group name="notify" label="सूचना कैसे भेजें"
    supporting-text="जो भी लागू हों, सभी चुनें।"
    required required-text="ज़रूरी"
    error-text="सूचना भेजने का कम से कम एक तरीक़ा चुनें।">
    <tanrei-checkbox value="email" label="ईमेल" checked></tanrei-checkbox>
    <tanrei-checkbox value="text" label="SMS"></tanrei-checkbox>
    <tanrei-checkbox value="push" label="पुश सूचना"></tanrei-checkbox>
  </tanrei-checkbox-group>
</form>

<script type="module">
  import '@tanrei/web/components/checkbox-group';

  const group = document.querySelector('tanrei-checkbox-group');
  group.addEventListener('change', (event) => {
    // event.detail.value नई लिस्ट है; group.value में भी वही आ चुकी है।
    group.error = event.detail.value.length === 0;
  });
  // प्रॉडक्ट जवाब को लिस्ट के रूप में सेट करता है। यह प्रॉपर्टी है: value ऐट्रिब्यूट नहीं होता।
  group.value = ['email', 'push'];
</script>
```

**React**

```tsx
import { Checkbox, CheckboxGroup } from '@tanrei/react';

const [channels, setChannels] = useState(['email']);

<CheckboxGroup name="notify" label="सूचना कैसे भेजें" supportingText="जो भी लागू हों, सभी चुनें।"
               value={channels} onChange={(event) => setChannels(event.detail.value)}
               error={channels.length === 0} errorText="सूचना भेजने का कम से कम एक तरीक़ा चुनें।">
  <Checkbox value="email" label="ईमेल" />
  <Checkbox value="text" label="SMS" />
  <Checkbox value="push" label="पुश सूचना" />
</CheckboxGroup>
```

मार्कअप में पहला मान वहीं लिखा जाता है जहाँ HTML उसे लिखता है: चेकबॉक्स पर `checked`। प्रॉडक्ट के `value` सेट कर देने के बाद, कौन-से चेकबॉक्स चेक किए हुए हैं, यह `value` तय करता है।

### सबको चेक करने वाला चेकबॉक्स

`selectAllLabel` दें, तो ग्रुप पहले चेकबॉक्स से पहले एक और चेकबॉक्स ले आता है, जिसका नाम वही टेक्स्ट है। जब तक वह हर चेकबॉक्स चेक किया हुआ है जिसे व्यक्ति बदल सकता है, यह चेक किया हुआ रहता है; जब तक कुछ चेक किए हुए हैं, अनिश्चित; और जब तक कोई नहीं, चेक नहीं किया हुआ। चेक नहीं किया हुआ या अनिश्चित रहते दबाने पर यह सबको चेक कर देता है; चेक किया हुआ रहते दबाने पर सबसे चेक हटा देता है। यह लिस्ट की एंट्री नहीं है और कुछ सबमिट नहीं करता।

```html
<tanrei-checkbox-group name="days" label="रिपोर्ट किस दिन भेजें" select-all-label="हर कामकाजी दिन">
  <tanrei-checkbox value="mon" label="सोमवार"></tanrei-checkbox>
  <tanrei-checkbox value="tue" label="मंगलवार"></tanrei-checkbox>
  …
</tanrei-checkbox-group>
```

जिस चेकबॉक्स को आपने ख़ुद अक्षम किया है, वह जैसा है वैसा ही छोड़ दिया जाता है, चेक किया हुआ हो या नहीं, और गिना नहीं जाता: सबको चेक करने वाला चेकबॉक्स सिर्फ़ उन्हीं विकल्पों को गिनता है जिन्हें व्यक्ति बदल सकता है। इस सेट के लिए लेबल, जैसे “ये सभी” या “हर कामकाजी दिन”, सवाल के शब्दों में लिखें; वह प्रॉडक्ट के शब्दों से कभी नहीं पढ़ा जाता।

### एक स्तर नीचे

वही सेट, अपने दोनों सदस्यों से हाथ से लिखा हुआ, वही तस्वीर है और सहायक तकनीक के लिए वही ग्रुप:

```html
<tanrei-field-group label="सूचना कैसे भेजें" supporting-text="जो भी लागू हों, सभी चुनें।"
                    required required-text="ज़रूरी">
  <tanrei-checkbox name="notify" value="email" label="ईमेल" checked></tanrei-checkbox>
  <tanrei-checkbox name="notify" value="text" label="SMS"></tanrei-checkbox>
  <tanrei-checkbox name="notify" value="push" label="पुश सूचना"></tanrei-checkbox>
</tanrei-field-group>
```

हाथ से लिखे गए फ़ील्ड ग्रुप और चेकबॉक्स जो नहीं करते, वह है जवाब को रखना:

| पहलू | हाथ से लिखा गया | चेकबॉक्स ग्रुप |
| --- | --- | --- |
| लिस्ट | प्रॉडक्ट उसे हर चेकबॉक्स से पढ़ता है | `value`, और एक `change` |
| जवाब सेट करना | हर चेकबॉक्स पर `checked` | `value = […]` |
| रीसेट और बहाल होना | हर चेकबॉक्स अपने आप | एक कंट्रोल |
| ज़रूरी सेट जो ख़ाली छोड़ा गया | प्रॉडक्ट जाँचता है | फ़ॉर्म का अपना वैलिडेशन उसे अस्वीकार करता है |
| ऐसा मान जिसका चेकबॉक्स दिखाया नहीं गया | खो जाता है | रखा रहता है |
| सबको चेक करने वाला चेकबॉक्स | प्रॉडक्ट लिखता है, `indeterminate` के साथ | `selectAllLabel` |
| फ़ॉर्म क्या सबमिट करता है | वही एंट्री | वही एंट्री |

एक स्तर नीचे तब जाएँ जब सेट एक जवाब नहीं है:

| आपको चाहिए | इस्तेमाल करें |
| --- | --- |
| थोड़े-से विकल्पों में से कई, एक नाम से एक जवाब के रूप में | चेकबॉक्स ग्रुप |
| ऐसे चेकबॉक्स जिनमें हर एक का फ़ॉर्म में अपना नाम है, या ऐसा सेट जिसमें कुछ ऐसा है जो चेकबॉक्स नहीं है | एक [फ़ील्ड ग्रुप](https://tanrei.chnotchy.com/hi/components/field-group/), जिसके भीतर [चेकबॉक्स](https://tanrei.chnotchy.com/hi/components/checkbox/) हैं |
| “सभी” का मतलब क्या है, इसका अपना नियम: किसी पेज का हर आइटम, मेल खाने वाला हर आइटम | एक [फ़ील्ड ग्रुप](https://tanrei.chnotchy.com/hi/components/field-group/), जिसमें एक ऐसा चेकबॉक्स है जिस पर आप `indeterminate` ख़ुद सेट करते हैं |
| थोड़े-से विकल्पों में से एक | [रेडियो ग्रुप](https://tanrei.chnotchy.com/hi/components/radio-group/) |
| किसी एक चीज़ को चालू या बंद करना | [चेकबॉक्स](https://tanrei.chnotchy.com/hi/components/checkbox/), या जहाँ असर तुरंत होता है वहाँ [स्विच](https://tanrei.chnotchy.com/hi/components/switch/) |
| बहुत-से विकल्पों में से कई, या कम जगह | [सिलेक्ट](https://tanrei.chnotchy.com/hi/components/select/), या बहु चयन वाली लिस्ट |

## स्पेक

### हर सदस्य क्या देता है

| पहलू | फ़ील्ड ग्रुप से | चेकबॉक्स से | ग्रुप का अपना |
| --- | --- | --- | --- |
| प्रॉपर्टी | `label`, `labelHidden`, `supportingText`, `errorText`, `error`, `disabled`, `required`, `optional`, `requiredMark`, `requiredText`, `optionalText`, `orientation` | हर चेकबॉक्स के `value`, `label` और `disabled`, चेकबॉक्स पर | `value`, `selectAllLabel` |
| इवेंट | — | कोई नहीं: ग्रुप के भीतर का चेकबॉक्स अपना कुछ फ़ायर नहीं करता | `change` |
| टोकन | `comp.field-group.*` | `comp.checkbox.*` | कोई नहीं |

- **ज़रूरी** का मतलब है कम से कम एक। कम से कम या ज़्यादा से ज़्यादा की कोई संख्या (“ज़्यादा से ज़्यादा तीन चुनें”) आपका नियम है: `change` में लिस्ट की लंबाई पढ़ें, `error` सेट करें और `errorText` में वह संख्या अपने शब्दों में लिखें।
- **त्रुटि** सेट की है। `error` आख़िरी चेकबॉक्स के नीचे `errorText` दिखाता है और हर चेकबॉक्स को उसकी अपनी त्रुटि की अवस्था में लाता है। ग्रुप इसे कभी सेट नहीं करता, और मान बदलने से यह नहीं हटती। जो ग्रुप त्रुटि में नहीं है, उसमें त्रुटि वाला एक चेकबॉक्स उस चेकबॉक्स का अपना `error` है।
- **अक्षम।** अक्षम ग्रुप अपना मान रखता है और कुछ सबमिट नहीं करता। जो चेकबॉक्स किसी सक्षम ग्रुप में अकेला अक्षम है, वह अपनी एंट्री रखता है और उसके साथ सबमिट होता है: जो विकल्प हमेशा चालू है, वह एक अक्षम, चेक किया हुआ चेकबॉक्स है, जिसके बग़ल में कोई छिपा फ़ील्ड नहीं चाहिए।
- सिर्फ़ पढ़ने वाला कोई स्टेट नहीं है, क्योंकि चेकबॉक्स में वह नहीं होता।

फ़्रेम क्या करता है, यानी ज़रूरी का निशान, विवरण, त्रुटि और वह कैसे पढ़कर सुनाई जाती है, कॉलम और वह पंक्ति जो रैप होती है, यह [फ़ील्ड ग्रुप के पेज](https://tanrei.chnotchy.com/hi/components/field-group/) पर है। चेकबॉक्स क्या करता है, यह [चेकबॉक्स के पेज](https://tanrei.chnotchy.com/hi/components/checkbox/) पर है।

### किसी एक ग्रुप को अलग करना

चेकबॉक्स ग्रुप का अपना कोई टोकन नहीं है। उसका फ़्रेम फ़ील्ड ग्रुप के टोकन पढ़ता है और उसके चेकबॉक्स चेकबॉक्स के, वे जहाँ भी सेट हों। किसी एक इंस्टेंस को बदलने के लिए, उस पर सदस्य का टोकन सेट करें:

```html
<tanrei-checkbox-group label="सूचना कैसे भेजें"
  style="--tanrei-comp-field-group-gap-controls: 12px">…</tanrei-checkbox-group>
```

- Category: Selection
- Level: composed
- Listing: default
- Built from: Field group, Checkbox
- Page: https://tanrei.chnotchy.com/components/checkbox-group/
- Spec: https://github.com/chnotchy/tanrei/blob/main/specs/checkbox-group.spec.json

### Availability

| Design system | Has it | Notes |
| --- | --- | --- |
| Tanrei (`tanrei`) | Yes | — |
| Cupertino (Apple HIG-inspired) (`cupertino`) | Yes | — |
| M3 Expressive-like (Material 3 Expressive-inspired) (`m3-expressive-like`) | Yes | — |
| M3-like (Material 3-inspired) (`m3-like`) | Yes | — |

### Platforms

- Web: the element `<tanrei-checkbox-group>`, registered by importing `@tanrei/web` (or only its own module, `@tanrei/web/components/checkbox-group`).
- React: `CheckboxGroup` from `@tanrei/react`.

| Platform | Name | Status |
| --- | --- | --- |
| Web | `tanrei-checkbox-group` | lagging |
| SwiftUI | `TanreiCheckboxGroup` | planned |
| Jetpack Compose | `TanreiCheckboxGroup` | planned |
| Flutter | `TanreiCheckboxGroup` | planned |
| React Native | `CheckboxGroup` | planned |

Names a platform gives in its own idiom:

| Spec | Web | SwiftUI | Jetpack Compose | Flutter | React Native |
| --- | --- | --- | --- | --- | --- |
| `value` (prop) | `value` | `selection` | `values` | `values` | `value` |
| `label` (prop) | `label` | `label` | `label` | `labelText` | `label` |
| `labelHidden` (prop) | `labelHidden` | `labelsHidden` | `labelHidden` | `labelHidden` | `labelHidden` |
| `supportingText` (prop) | `supportingText` | `supportingText` | `supportingText` | `helperText` | `supportingText` |
| `error` (prop) | `error` | `error` | `isError` | `isError` | `error` |
| `disabled` (prop) | `disabled` | `disabled` | `enabled` | `enabled` | `disabled` |
| `required` (prop) | `required` | `isRequired` | `required` | `required` | `required` |
| `optional` (prop) | `optional` | `isOptional` | `optional` | `optional` | `optional` |
| `change` (event) | `change` | `selection` | `onValuesChange` | `onChanged` | `onValueChange` |

Statuses: `planned` — In the inventory. Nothing shippable exists yet. `lagging` — An implementation of an earlier spec exists; it has not caught up with the current one. `alpha` — Implemented with tests. The API may still change. `beta` — Feature complete and at parity. Only fixes are expected. `stable` — Covered by semantic versioning. `deprecated` — Still shipped; scheduled for removal.

### Anatomy

- `label`: The field group's label: names the set — the question — above the checkboxes. The requirement mark follows it.
- `requirement-label` (optional): The field group's requirement mark: a small tag that is not a control, saying an answer is required or optional; or, for required, an asterisk after the label.
- `supporting-text` (optional): The field group's description: a line under the label, before the checkboxes, that says how to answer. It stays while the group is in error.
- `select-all` (optional): One more checkbox before the first, brought by the group where selectAllLabel is given: the Checkbox component, checked, unchecked or indeterminate from the checkboxes of the set, and checking or unchecking them all. It is no entry of the value.
- `checkboxes`: The checkboxes of the set, in the order given, in a column or in a row that wraps. Each is the Checkbox component with its own label, drawn from its own tokens; which of them are checked is the group's value.
- `error-text` (optional): The field group's error text: the reason the answer was refused or is missing, below the last checkbox.

### Props

| Prop | Type | Default | Web attribute | Description |
| --- | --- | --- | --- | --- |
| `value` | `strings` | `` | — | The values of the checked checkboxes: a list of strings, empty while none is checked (the platforms whose idiom it is take a set). The checkbox group sets it when a person switches a checkbox, and emits change; the product may also set it. It is the set's value: what a form submits under the group's one name. |
| `label` | `string` | `""` | `label` | Names the set, visibly and to assistive technology: the question its controls answer ("Notify me by"). Required. (From Field group.) |
| `labelHidden` | `boolean` | `false` | `label-hidden` | Does not draw the label, which stays the accessible name of the group. For a set whose visible heading is elsewhere. (From Field group.) |
| `supportingText` | `string` | `""` | `supporting-text` | The description: how to answer ("Choose all that apply"), drawn under the label and given to assistive technology as the group's description. (From Field group.) |
| `errorText` | `string` | `""` | `error-text` | What is wrong with the set as a whole and how to put it right ("Choose at least one"), drawn below the controls while error is true. (From Field group: On the web it is also what the form's own validation says of a required group left empty (CKG-8).) |
| `error` | `boolean` | `false` | `error` | Puts the set in the error condition: the error text is drawn, and each selection control that has an error condition of its own (a checkbox, a radio button) is drawn in it. What an answer means is the product's to validate; the group never sets this itself. One control of a valid group may still be in error by itself. (From Field group: Every checkbox of the set is drawn in its own error condition and exposed as invalid.) |
| `disabled` | `boolean` | `false` | `disabled` | Disables every control of the set and draws the frame as disabled. (From Field group: The value is kept, and on the web it is not submitted (CKG-6, CKG-8).) |
| `required` | `boolean` | `false` | `required` | What the form asks of the set: true exposes it as required and draws the required mark beside the label. It never validates: a missing answer is the product's to report with error. (From Field group: means at least one checkbox checked: on the web an empty list is reported to the form's own validation (CKG-8).) |
| `optional` | `boolean` | `false` | `optional` | Draws the optional tag after the label and adds optionalText to the group's description, because assistive technology has no state for it. Ignored while required is true: a set is never both. (From Field group.) |
| `requiredMark` | `enum`: `auto`, `tag`, `asterisk`, `none` | `"auto"` | `required-mark` | How this set shows that it is required: tag is a small filled Tag with requiredText, asterisk is "*" after the label, none draws nothing and keeps the semantics. Auto takes comp.field-group.requirement.mark, which follows sys.behavior.requirement-mark, the system's one answer. Ignored unless required is true. (From Field group.) |
| `requiredText` | `string` | `""` | `required-text` | The text of the required tag, in the product's language ("Required", "必須"). The product's: Tanrei has no word for it. Empty reads the product's words; with neither, FGR-24 says what is drawn. (From Field group.) |
| `optionalText` | `string` | `""` | `optional-text` | The text of the optional tag, in the product's language ("Optional", "任意"); also read to assistive technology as part of the description. The product's: Tanrei has no word for it. Empty reads the product's words. (From Field group.) |
| `orientation` | `enum`: `vertical`, `horizontal` | `"vertical"` | `orientation` | vertical stacks the controls in one column, the default and the form to prefer: every label starts on one edge and is read down. horizontal lays them out in a row that wraps, for two or three short options or a row of fields. (From Field group.) |
| `selectAllLabel` | `string` | `""` | `select-all-label` | Not empty: the group brings one more checkbox before the first, labelled by this text ("All of these", "Every weekday"), that checks or unchecks every enabled checkbox of the set at once and shows checked, unchecked or indeterminate from them (CKG-12, CKG-13). Empty, the default: there is none. The instance's own words: it names this set, so it is not read from the product's words. |

### Events

| Event | Description |
| --- | --- |
| `change` | The person switched a checkbox of the set, or activated the select-all checkbox; carries the new list, which the group already holds. Emitted once per action, by the group and not by its checkboxes. Not emitted when the product sets value. |

### Item: `checkbox`

A choice of the set: the Checkbox component with its own label, checked by the group's value, placed, spaced, disabled and put in its error condition by the group's frame, otherwise drawn and pressed as it is anywhere.

It is a Checkbox.

Names: Web `tanrei-checkbox`, SwiftUI `TanreiCheckbox`, Jetpack Compose `TanreiCheckbox`, Flutter `TanreiCheckbox`, React Native `Checkbox`.

| Prop | Type | Default | Web attribute | Description |
| --- | --- | --- | --- | --- |
| `value` | `string` | `""` | `value` | What the choice stands for: an entry of the group's value while this checkbox is checked. Unique in the group and not empty. The group reads it from the item; it is not a prop of the Checkbox (on the web, the checkbox's own value attribute). |
| `label` | `string` | `""` | `label` | Its own label, as the Checkbox's label. |
| `disabled` | `boolean` | `false` | `disabled` | As the Checkbox's disabled: one checkbox of an enabled group may be disabled by itself. The person cannot switch it, the select-all checkbox leaves it alone, and its entry stays in the value while the value holds it. |

### States

`enabled`, `disabled`, `error`

### Accessibility

- Role: `group`
- Labeling: label names the group, drawn or not (labelHidden). Each checkbox keeps its own name, its own label beside it; the select-all checkbox is named by selectAllLabel. The group's description is the field group's: supportingText, then errorText while error is true, then requiredText while the group is required, then optionalText while it is optional (FGR-11). A group has no required and no invalid state: the requirement is said in the product's words, and each checkbox of a group in error is exposed as invalid and described by errorText. How many are checked is not said unless the product writes it in supportingText.
- Minimum target size: yes

| Keys | Action |
| --- | --- |
| Tab / Shift+Tab | Moves focus to each enabled checkbox of the set in the order given — the select-all checkbox first where there is one — and out of the group. Every checkbox is a stop; the group is not (CKG-5). |
| Space | Switches the focused checkbox (CHK-1); on the select-all checkbox, checks every enabled checkbox of the set, or unchecks them all where all were checked (CKG-13). |
| Arrow keys | Nothing: a set of checkboxes has no arrow keys on any platform, because moving among them must not change them and each is a stop already. |
| Enter | Nothing on the web, where it submits the form; switches the focused checkbox where the platform activates any focused control with Enter (Android, tvOS), as CHK-1 says. |

- Not a target itself: the group takes no press and is not a focus stop (CKG-5), so minimumTarget holds through its checkboxes, each of which keeps a whole touch target of its own at the distance the field group puts between them (CHK-7, FGR-3).
- The checkbox group is a field group of checkboxes that owns their value (composed: the field group frames it, its checkboxes hold its value). What it adds to the two is what every product otherwise writes: the list of checked values and one change for it, one name in a form with reset and the form's own check that a required set is not empty, and the select-all checkbox's three states. It adds no look and has no tokens of its own.
- One level down is always open: a field group around checkboxes, each checked by the product, is the same picture, the same group, the same names, descriptions and states. Take it where each checkbox must have a name of its own in the form, where the set holds something that is not a checkbox, or where the product wants its own rule for what "all" means.
- Beside the radio group. A radio group has one answer, so it is one stop in the focus order, its arrow keys move and select, and its role has a required and an invalid state. A checkbox group has a list: every checkbox is a stop and Space switches it, there are no arrow keys, and its role is the plain group's — the requirement is said in words and each checkbox says invalid for itself. A radio group in error leaves its rings as they are; a checkbox group in error marks every box, because a checkbox has an error condition and a radio button has none.
- required means "at least one". A least or a greatest number of choices ("choose up to three") is the product's rule: it reads the length of the list in change, sets error and writes errorText with the number in its own words, or disables what may no longer be chosen. The group knows no number, because it would have no words to say it with.
- The select-all checkbox stands for the checkboxes the group holds and a person can switch, never for choices the product has not given it. It is one more stop before the set. It is not the place for a hierarchy: choices inside choices are a tree.
- A disabled group is not submitted; a checkbox disabled by itself in an enabled group keeps its entry in the value and is submitted with it. A choice that is always on ("Email, required for your account") is therefore one disabled, checked checkbox, and needs no hidden field beside it.
- When a checkbox group, and when something else. Several of a few choices that are all worth seeing at once, in a form or a setting: a checkbox group, of up to about seven. One of a few: a radio group. One thing on or off, on its own: a checkbox, or a switch where it takes effect at once. Several of many, or where there is little room: a list with multiple selection, or a select. Rows of a table chosen for an action: the table's own selection. Things on or off that are not one answer — each with a name of its own in the form — or a set of switches: a field group.
- On the web the group's shadow root holds the field group's own element around a slot, and the checkboxes stay the product's children: the group is the field group's `fieldset` with its `legend`, exposed once.
- Heights are the texts' and the checkboxes': at 200% text size every text wraps, a row becomes a column, and nothing is cut (WCAG 1.4.4, 1.4.10).
- How a state looks is a value decision of the active design system; components read the state's tokens and never compute the effect themselves.

### Behaviour

Requirements in EARS form, each with its stable id.

- **CKG-1** THE checkbox group SHALL be a field group whose spacing is controls, around its checkboxes: the field group itself, with the field group's own tokens, measures and sentences, and no copy of it — its rows, their order and their gaps (FGR-1), the label (FGR-2), the requirement, its mark and its words (FGR-4, FGR-5, FGR-6, FGR-24), the description, which stays while the group is in error (FGR-7), the error text (FGR-8), the column and the row that wraps (FGR-3, FGR-13), the disabled frame (FGR-14) and what an unknown value of required, optional, requiredMark or orientation does (FGR-22), each from the prop of the same name, which is the field group's. It SHALL have no look and no token of its own: it SHALL draw no container, edge, fill or elevation, SHALL add no padding around its rows and no distance between its checkboxes but the field group's, and SHALL leave each checkbox drawn from the checkbox's own tokens at the checkbox's own size (CHK-4, CHK-12, CHK-15).
- **CKG-2** THE checkbox group SHALL hold one value, a list of strings, and show as checked exactly those of its checkboxes whose value is in the list; WHILE the list is empty none SHALL be checked. WHEN the product sets value THE checkbox group SHALL check and uncheck its checkboxes to match, each over the checkbox's own selection motion (CHK-13), without emitting change and without moving focus. THE checkbox group SHALL keep in value an entry that is the value of none of its checkboxes, because the checkbox it belongs to may arrive later or be out of the set for now (a list of choices narrowed by a search), and SHALL give it back with the rest in change (CKG-4) and to a form (CKG-8). IF value holds one entry twice THEN THE checkbox group SHALL treat it as held once; IF two checkboxes carry one value THEN both SHALL be shown checked or unchecked together, and switching either SHALL switch the entry; IF a checkbox carries no value THEN it SHALL be drawn unchecked and a press on it SHALL change nothing and emit nothing, because the list has no entry to stand for it; and in debug builds THE checkbox group SHALL report each of the three.
- **CKG-3** WHERE the platform lets the product mark one checkbox as checked by itself (on the web, checked on a child element) and the product has not set value, THE checkbox group SHALL take as its value the values of the checkboxes so marked, in the order given, so that markup that says checked on some of its checkboxes is a group with that value, and a checkbox that arrives so marked SHALL add its value to the list. WHEN the product has set value, value SHALL decide: a checkbox that is first drawn or arrives marked against it SHALL be shown as value says. WHEN the product sets or clears checked on a checkbox the checkbox group already holds THE checkbox group SHALL add that checkbox's value to the list or take it out, without emitting change, so that the two never disagree.
- **CKG-4** WHEN the person switches one of the group's checkboxes — by pointer, touch, Space, a click on its label or assistive technology, as CHK-1 says of the checkbox — THE checkbox group SHALL add that checkbox's value to the list where the checkbox became checked and take it out where it became unchecked, and SHALL emit change exactly once, carrying the new list, with value already set when the event is received. The list it then holds SHALL be the values of its checked checkboxes in the order the checkboxes are given, not the order in which they were checked, followed by the entries that belong to no checkbox, in the order they had. No other checkbox SHALL change, and nothing the checkbox emits SHALL reach a listener on the group as a second change (CHK-23). A person can empty the list: unchecking the last checked checkbox emits change with an empty list.
- **CKG-5** THE checkbox group SHALL leave every enabled checkbox its own place in the focus order, in the order given, as the platform has it for checkboxes: Tab and Shift+Tab SHALL move from one checkbox to the next and out of the group at either end, and THE checkbox group SHALL handle no key — no arrow key moves focus or checks, and there is no single stop and no roving focus — because each checkbox is a choice of its own that a person may stop at and switch; Space is the checkbox's (CHK-1), and Enter is left to the form on the web. THE checkbox group SHALL NOT be a stop itself, and a press on its label, its requirement mark, its description or its error text SHALL check nothing and move no focus into the group (FGR-12). WHEN the product asks the group itself for focus, where the platform has such a call, THE checkbox group SHALL give focus to the first enabled checkbox it shows, the select-all checkbox where one is drawn.
- **CKG-6** WHILE disabled is true THE checkbox group SHALL be a disabled field group (FGR-14): its frame drawn from the field group's disabled tokens and every checkbox it holds disabled as the checkbox's own disabled does (CHK-3, CHK-8), the checked ones still shown checked; it SHALL emit no change and SHALL keep value. WHILE disabled is false THE checkbox group SHALL NOT enable a checkbox the product disabled itself: that one keeps its entry in the list WHILE the list holds it, is shown checked or unchecked as value says, cannot be switched by the person, and is left as it is by the select-all checkbox (CKG-13). THE checkbox group SHALL have no read-only state, because a checkbox has none and a composed component adds no state its members have not.
- **CKG-7** THE checkbox group SHALL take from required and optional what the form asks of the set, as a field group does (FGR-4): required means that the list holds at least one entry.
- **CKG-8** WHERE the platform has forms that submit named values (the web) THE checkbox group SHALL take part in its form as one control: WHILE it is not disabled it SHALL submit one entry under its own name for each entry of value, in the list's order, and nothing WHILE the list is empty — what checkboxes of one name submit by themselves, so that whatever receives the form reads the same list from either; SHALL return to the value it was first given WHEN the form is reset, without emitting change; SHALL be disabled WHILE the form disables the set it is in; SHALL report a missing value to the form's own validation WHILE required is true and the list is empty, in the product's words, because the platform has a message for one unchecked checkbox and none for a set; and its checkboxes, the select-all checkbox among them, SHALL submit nothing of their own, whatever name they carry (CHK-23), so that no entry is submitted twice. A checkbox the product disabled itself SHALL still have its entry submitted WHILE the list holds it, because the value is the group's and that checkbox's disabled says only that the person cannot switch it. WHERE the platform has no such forms value and change are the whole of it.
- **CKG-9** THE checkbox group SHALL be exposed to assistive technology as the field group it is, and SHALL add nothing to it: one group that contains its checkboxes, named by label whether or not the label is drawn (FGR-10); described by supportingText, errorText WHILE error is true, requiredText WHILE required is true and optionalText WHILE optional is true (FGR-11); and disabled WHILE disabled is true (FGR-14). A group has neither a required nor an invalid state, so the requirement is said in the product's words and each checkbox says invalid for itself. Each checkbox SHALL expose its own role, its name and its checked state (CHK-14), and the select-all checkbox its mixed state WHILE it is indeterminate. THE checkbox group SHALL NOT expose a second group around the first, SHALL give its checkboxes no position in a set, and SHALL NOT say how many are checked: a product that wants the count said writes it in supportingText.
- **CKG-10** WHEN a checkbox is added to the group, removed from it or moved, or its value or its disabled changes, while the group is shown THE checkbox group SHALL be laid out again as a field group is (FGR-23); SHALL check by value again (CKG-2), so that a checkbox that arrives with a value the list holds is shown checked, and SHALL keep the entry of a checked checkbox that leaves; SHALL set the select-all checkbox again (CKG-12); SHALL emit no change; and SHALL leave focus on the checkbox that has it.
- **CKG-11** THE checkbox group SHALL hold checkboxes and nothing else that can be operated. IF it holds no checkbox THEN THE checkbox group SHALL draw its rows without one and in debug builds report it (FGR-20); IF it holds another control, or a group of controls inside it, THEN in debug builds THE checkbox group SHALL report it and SHALL make no entry of its value from what that one holds. THE checkbox group SHALL NOT restyle a checkbox or change how it answers hover, focus or a press (CHK-5 to CHK-10), and SHALL NOT set indeterminate on a checkbox of the set: a checkbox of the set is in the list or it is not.
- **CKG-12** WHILE selectAllLabel is not empty THE checkbox group SHALL bring one more checkbox, the select-all checkbox: the Checkbox component itself, labelled by selectAllLabel, placed before the first checkbox of the set as one more control of the field group — the same distance from the next, in a column or in a row, the set not indented under it — and so disabled and put in its error condition with the others (CKG-6, CKG-7). It SHALL stand for the checkboxes of the set that the product did not disable one by one: checked WHILE each of them is checked, indeterminate WHILE some are and some are not, unchecked WHILE none is (CHK-4), and disabled WHILE there is no such checkbox. It SHALL have no value, SHALL be no entry of the list, and SHALL follow every change of value and of the set at once, whoever made the change. WHILE selectAllLabel is empty THE checkbox group SHALL bring none.
- **CKG-13** WHEN the person activates the select-all checkbox while it is unchecked or indeterminate THE checkbox group SHALL check every checkbox of the set that the product did not disable itself, as CHK-2 says of an indeterminate checkbox, and while it is checked SHALL uncheck every one of them; a checkbox the product disabled SHALL stay as it is, and an entry of value that belongs to no checkbox SHALL stay in the list. THE checkbox group SHALL emit change exactly once, carrying the list after the change (CKG-4), and nothing of the select-all checkbox's own SHALL reach a listener on the group.
- **CKG-14** THE checkbox group SHALL add nothing of its own to how its members answer the layout direction, enlarged text and forced colors. WHERE the layout direction is right-to-left it SHALL be mirrored as the field group is (FGR-18), SHALL take its direction from where it is used and follow a change of it at once (FGR-19), keeping its value and its focus, and SHALL lay out each of its texts by that text's own direction (FGR-21), each checkbox mirroring itself (CHK-15, CHK-20, CHK-21); it has no key to exchange (CKG-5). WHILE the text size is enlarged it SHALL grow as the field group does (FGR-16): every text wraps, a row becomes a column where one line no longer holds two checkboxes, and the boxes keep their size. WHERE the platform draws with a person's own forced colors it SHALL be drawn as the field group is there (FGR-17), the error carried by the words of errorText and by each checkbox's invalid state, never by a color of the group's.
- **CKG-15** WHERE the platform has ARIA attributes (the web), WHEN the product sets an aria- attribute on the host, by the attribute or by the ARIA property that reflects it, THE checkbox group SHALL move it to the data-aria- attribute of the same name, so that the host is no second node with its name, description or state, and SHALL expose it on the group of the field group it is (CKG-9) — an id reference by the elements it names in the host's tree or a tree around it, a description after its own — except those the checkbox group owns (aria-label, aria-labelledby, aria-disabled, aria-required, aria-invalid, aria-errormessage), which it SHALL move and not expose: its name is label and its states are its props (CKG-9). WHEN the product removes the aria- attribute or its data-aria- twin, or sets the ARIA property that reflects it (ariaLabel, ariaDescribedByElements…) to null, THE checkbox group SHALL take it off that element. WHEN the product sets an aria- attribute the checkbox group owns THE checkbox group SHALL report it in debug builds.

### Tokens

As written in the token documents (DTCG): an alias in braces names the token it takes its value from, which each design system resolves. On the web each token is a CSS custom property: `--tanrei` and the name after `tanrei`, joined by hyphens (`tanrei.comp.field-group.…` → `--tanrei-comp-field-group-…`).

#### `tanrei.comp.field-group`

| Token | Type | Value |
| --- | --- | --- |
| `comp.field-group.label.typescale` | `typography` | `{tanrei.sys.typescale.label}` |
| `comp.field-group.label.gap` | `dimension` | `{tanrei.sys.space.space100}` |
| `comp.field-group.requirement.mark` | `number` | `{tanrei.sys.behavior.requirement-mark}` |
| `comp.field-group.requirement.gap` | `dimension` | `{tanrei.sys.space.space100}` |
| `comp.field-group.requirement.asterisk-gap` | `dimension` | `{tanrei.sys.space.space25}` |
| `comp.field-group.supporting-text.typescale` | `typography` | `{tanrei.sys.typescale.label-small}` |
| `comp.field-group.supporting-text.gap` | `dimension` | `{tanrei.sys.space.space50}` |
| `comp.field-group.error-text.gap` | `dimension` | `{tanrei.sys.space.space50}` |
| `comp.field-group.gap.controls` | `dimension` | `{tanrei.sys.space.space100}` |
| `comp.field-group.gap.fields` | `dimension` | `{tanrei.sys.space.space300}` |
| `comp.field-group.gap-inline` | `dimension` | `{tanrei.sys.space.space200}` |
| `comp.field-group.field.min-width` | `dimension` | `144px` |
| `comp.field-group.standard.label.color` | `color` | `{tanrei.sys.color.on-surface}` |
| `comp.field-group.standard.supporting-text.color` | `color` | `{tanrei.sys.color.on-surface-variant}` |
| `comp.field-group.standard.required-asterisk.color` | `color` | `{tanrei.sys.color.primary}` |
| `comp.field-group.standard.error-text.color` | `color` | `{tanrei.sys.color.error}` |
| `comp.field-group.standard.error.label.color` | `color` | `{tanrei.sys.color.on-surface}` |
| `comp.field-group.standard.error.supporting-text.color` | `color` | `{tanrei.sys.color.on-surface-variant}` |
| `comp.field-group.standard.error.required-asterisk.color` | `color` | `{tanrei.sys.color.primary}` |

Per-state tokens, valued by the design system's pattern rules (not written by hand):

- `comp.field-group.<variant>.<state>.<property>` for the variants `standard`, the states `disabled` and the properties `label.color`, `supporting-text.color`, `required-asterisk.color`, `error-text.color`, `error.label.color`, `error.supporting-text.color`, `error.required-asterisk.color`.

### वेब क्या अलग ढंग से बनाता है

- एलिमेंट के शैडो रूट में एक `<tanrei-field-group>` रहता है, जिसके भीतर सबको चेक करने वाला चेकबॉक्स है, जब तक `select-all-label` दिया गया है, और एक स्लॉट। चेकबॉक्स आपके अपने चाइल्ड रहते हैं। एलिमेंट को इंपोर्ट करने से दोनों सदस्य डिफ़ाइन हो जाते हैं।
- `value` सिर्फ़ प्रॉपर्टी है: एक ऐरे, जो भीतर आते और बाहर जाते समय कॉपी होता है। `value` ऐट्रिब्यूट नहीं है, क्योंकि ऐट्रिब्यूट में लिस्ट को ऐसा सेपरेटर चाहिए जो किसी मान में भी हो सकता है, और HTML के पास इसका रूप पहले से है: हर चाइल्ड पर `checked`।
- जिस चेकबॉक्स पर न `value` ऐट्रिब्यूट है और न कोई मान सेट है, उसका कोई मान नहीं है: अकेला चेकबॉक्स जो “on” सबमिट करता है, वह ग्रुप में नहीं पढ़ा जाता। वह चेक नहीं किया हुआ दिखाया जाता है, और डीबग बिल्ड उसकी रिपोर्ट करता है।
- यह फ़ॉर्म से जुड़ा एलिमेंट है। वह `name` और `form` लेता है, और हर मान के लिए `name` से एक एंट्री सबमिट करता है, वही जो एक ही नाम के नेटिव चेकबॉक्स सबमिट करते हैं। उसके चेकबॉक्स कुछ सबमिट नहीं करते, उन पर चाहे जो `name` हो। रीसेट होने पर वह अपने पहले मान पर लौटता है, अक्षम `<fieldset>` के साथ अक्षम होता है, और जब तक `required` सेट है और लिस्ट ख़ाली है, फ़ॉर्म को बताता है कि मान नहीं है। संदेश `error-text` है, वह न हो तो ज़रूरी का टेक्स्ट, वह भी न हो तो `label`: `error-text` शुरू से दें, सिर्फ़ तब नहीं जब `error` सेट हो।
- `change` एक CustomEvent है, जिसका `detail.value` लिस्ट की एक कॉपी है; उससे पहले `input` फ़ायर होता है। ग्रुप के भीतर के किसी चेकबॉक्स पर लगा लिसनर दोनों में से कोई नहीं सुनता।
- भाग: `field-group` फ़्रेम है, और उसके भागों के नाम यहाँ वही हैं जो एक स्तर नीचे हैं: `label`, `requirement-label`, `supporting-text`, `error-text`। `select-all` सबको चेक करने वाला चेकबॉक्स है, और उसके भाग `select-all-container`, `select-all-box`, `select-all-mark` और `select-all-label` हैं। आपके अपने चेकबॉक्स को स्टाइल वैसे ही दिया जाता है जैसे कहीं भी, `tanrei-checkbox::part(…)` से।
- एलिमेंट पर ख़ुद फ़ोकस नहीं जा सकता। `focus()` पहले सक्षम चेकबॉक्स पर जाता है, और पेज का अपना `<label for>` फ़ोकस वहीं ले जाता है।
- एलिमेंट का कोई रोल नहीं है। उसे `label` से नाम दें, और जहाँ लेबल कहीं और दिखाया गया है वहाँ साथ में `label-hidden` दें। उसे `aria-label` से कभी नाम न दें, जो यहाँ किसी चीज़ को नाम नहीं देता।
- ऐट्रिब्यूट kebab-case में हैं: `label-hidden`, `supporting-text`, `error-text`, `required-mark`, `required-text`, `optional-text`, `select-all-label`।
- एलिमेंट के डिफ़ाइन होने से पहले, और स्क्रिप्ट के बिना, उसका अपना कुछ नहीं दिखता: चेकबॉक्स सादे कॉन्टेंट के रूप में दिखते हैं। जिस पेज को स्क्रिप्ट के बिना काम करना है, वह एक ही `name` के नेटिव चेकबॉक्स का एक नेटिव `<fieldset>` लिखता है, जो वही एंट्री सबमिट करता है।

## दिशानिर्देश

### करें

- लेबल को सवाल के रूप में लिखें, और हर चेकबॉक्स के लेबल को उसके एक जवाब के रूप में।
- जवाब कैसे देना है, यह `supportingText` में बताएँ: “जो भी लागू हों, सभी चुनें।”
- कॉलम को तरजीह दें। पंक्ति सिर्फ़ थोड़े-से छोटे लेबल के लिए इस्तेमाल करें।
- जब भी ग्रुप ज़रूरी हो, `errorText` दें, ताकि फ़ॉर्म का अपना वैलिडेशन यह बात आपके शब्दों में कहे।
- सबको चेक करने वाला चेकबॉक्स छह या उससे ज़्यादा के सेट के लिए, फ़िल्टर के लिए और अनुमतियों के सेट के लिए इस्तेमाल करें।

### न करें

- थोड़े-से विकल्पों में से एक जवाब के लिए चेकबॉक्स ग्रुप इस्तेमाल न करें: वह [रेडियो ग्रुप](https://tanrei.chnotchy.com/hi/components/radio-group/) है।
- चेकबॉक्स को सबमिट कराने के लिए उन्हें `name` न दें: लिस्ट को ग्रुप अपने नाम से सबमिट करता है।
- इसमें ऐसा कुछ न रखें जिसे ऑपरेट किया जा सकता है और जो चेकबॉक्स नहीं है। डीबग बिल्ड उसकी रिपोर्ट करता है, और वह मान में कोई एंट्री नहीं बनाता।
- हायरार्की दिखाने के लिए सेट को सबको चेक करने वाले चेकबॉक्स के नीचे इंडेंट न करें। विकल्पों के भीतर विकल्प एक ट्री है।
- ग्रुप को `aria-label` से नाम न दें। जहाँ कोई लेबल नहीं दिखाना है, वहाँ `label` और `labelHidden` दें।

## सुलभता

### कंपोनेंट क्या सँभालता है

- यह एक ग्रुप है, फ़ील्ड ग्रुप का, जिसमें इसके चेकबॉक्स रहते हैं। उसका नाम `label` है, चाहे वह दिखाया गया हो या नहीं; उसका विवरण सहायक टेक्स्ट है, त्रुटि में रहते त्रुटि टेक्स्ट, और प्रॉडक्ट के शब्दों में ज़रूरी या वैकल्पिक होना।
- ग्रुप में न ज़रूरी का स्टेट होता है, न अमान्य का। ज़रूरी होना शब्दों में कहा जाता है, और त्रुटि वाले ग्रुप का हर चेकबॉक्स अमान्य के रूप में दिया जाता है और त्रुटि टेक्स्ट उसका विवरण होता है।
- हर चेकबॉक्स अपना रोल, नाम और चेक होने का स्टेट रखता है। जब तक कुछ चेक किए हुए हैं, सबको चेक करने वाला चेकबॉक्स mixed कहता है। किसी चेकबॉक्स की सेट में कोई जगह नहीं होती, और कितने चेक किए हुए हैं, यह नहीं कहा जाता।
- हर सक्षम चेकबॉक्स Tab कुंजी के लिए अपना अलग पड़ाव है, और सबको चेक करने वाला चेकबॉक्स सबसे पहले। Space उसे बदलती है जिस पर फ़ोकस है। ऐरो कुंजियाँ नहीं हैं, और Enter फ़ॉर्म के लिए छोड़ दी जाती है।
- लेबल, ज़रूरी या वैकल्पिक के निशान, विवरण या त्रुटि टेक्स्ट पर दबाने से न कुछ चेक होता है, न फ़ोकस कहीं जाता है।
- जो त्रुटि किसी चेकबॉक्स पर फ़ोकस रहते हुए आती है, उसे फ़ील्ड ग्रुप एक बार, बिना टोके (polite), पढ़कर सुनाता है।
- दिशा, बड़ा किया गया टेक्स्ट और फ़ोर्स्ड कलर्स, इन सबको हर सदस्य अपने ढंग से सँभालता है: दाएँ से बाएँ वाले लेआउट में फ़्रेम और हर चेकबॉक्स मिरर होते हैं; 200% टेक्स्ट पर हर टेक्स्ट रैप होता है, पंक्ति कॉलम बन जाती है और कुछ भी आड़ा स्क्रॉल नहीं होता।
- इसके अपने कोई शब्द नहीं हैं। `requiredText` और `optionalText` ख़ाली छोड़े जाएँ तो फ़ील्ड ग्रुप उन्हें प्रॉडक्ट के शब्दों से पढ़ता है।

वेब पर ज्ञात कमियाँ: स्क्रीन रीडर ग्रुप के बारे में क्या कहते हैं, यह ब्राउज़र के एक्सेसिबिलिटी ट्री से पढ़ा गया है, स्क्रीन रीडर से सुना नहीं गया। Chromium अपने एक्सेसिबिलिटी ट्री में एलिमेंट को उसका अपना एक नोड देता है, क्योंकि फ़ॉर्म उसे वैलिडेट करता है: ग्रुप के चारों ओर एक नोड, जिसका न कोई रोल है न नाम।

### आपको क्या करना है

- `label` हमेशा दें, और हर चेकबॉक्स पर एक `label`।
- जहाँ ग्रुप ज़रूरी या वैकल्पिक है, वहाँ `requiredText` और `optionalText` दें, ग्रुप पर या पूरे प्रॉडक्ट के लिए एक बार: ग्रुप में ज़रूरी का कोई स्टेट नहीं होता, इसलिए यह बात शब्द ही कहते हैं।
- क्या ग़लत है, और उसे कैसे ठीक किया जाए, यह `errorText` में बताएँ। रंग कभी अकेला संकेत नहीं होता।
- जहाँ चुने गए विकल्पों की संख्या मायने रखती है (“5 में से 2 चुने गए”), वहाँ उसे `supportingText` में लिखें: वरना वह पढ़कर नहीं सुनाई जाती।
