Choice Group
Native controls work. Demo links and submissions stay inside this specimen. This example scrolls horizontally at this width.
Source markup
<!-- @dsCard group="Inputs" height=344 -->
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Choice group</title>
<style>
/* Preview layout only; native controls and type come from bundle.css. */
.choice-demo { display: grid; gap: var(--space-md); padding: var(--space-sm); }
.choice-demo__groups {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(min(100%, calc(var(--space-3xl) * 3)), 1fr));
gap: var(--space-md);
align-items: start;
}
.choice-demo__group { min-inline-size: 0; padding: 0; border: 0; }
.choice-demo__legend { padding: 0; margin-block-end: var(--space-2xs); }
.choice-demo__option {
display: flex;
align-items: center;
gap: var(--space-2xs);
min-block-size: calc(var(--space-lg) + var(--space-3xs));
padding-block: var(--space-3xs);
}
.choice-demo__option .control { flex: none; }
</style>
</head>
<body>
<main class="choice-demo">
<h1 class="t-h3">Choice group</h1>
<p class="field__help">Static examples. Native selection works; validation and submission are not connected.</p>
<div class="choice-demo__groups">
<fieldset class="choice-demo__group" aria-describedby="nz-export-content-help">
<legend class="field__label choice-demo__legend">Include in export</legend>
<div class="field">
<p class="field__help" id="nz-export-content-help">Choose any. Attachments are unavailable until a file is added.</p>
<label class="field__label choice-demo__option" for="nz-export-summary">
<input class="control" id="nz-export-summary" name="export-content" type="checkbox" value="summary" checked aria-describedby="nz-export-content-help">
<span>Summary</span>
</label>
<label class="field__label choice-demo__option" for="nz-export-notes">
<input class="control" id="nz-export-notes" name="export-content" type="checkbox" value="notes" aria-describedby="nz-export-content-help">
<span>Detailed notes</span>
</label>
<label class="field__label choice-demo__option" for="nz-export-attachments">
<input class="control" id="nz-export-attachments" name="export-content" type="checkbox" value="attachments" disabled aria-describedby="nz-export-content-help">
<span>Attachments (unavailable)</span>
</label>
</div>
</fieldset>
<fieldset class="choice-demo__group" aria-describedby="nz-export-format-help">
<legend class="field__label choice-demo__legend">Export format</legend>
<div class="field">
<p class="field__help" id="nz-export-format-help">Choose one. PDF is unavailable in this example.</p>
<label class="field__label choice-demo__option" for="nz-export-text">
<input class="control" id="nz-export-text" name="export-format" type="radio" value="text" checked aria-describedby="nz-export-format-help">
<span>Plain text</span>
</label>
<label class="field__label choice-demo__option" for="nz-export-markdown">
<input class="control" id="nz-export-markdown" name="export-format" type="radio" value="markdown" aria-describedby="nz-export-format-help">
<span>Markdown</span>
</label>
<label class="field__label choice-demo__option" for="nz-export-pdf">
<input class="control" id="nz-export-pdf" name="export-format" type="radio" value="pdf" disabled aria-describedby="nz-export-format-help">
<span>PDF (unavailable)</span>
</label>
</div>
</fieldset>
</div>
</main>
</body>
</html>
Native checkboxes allow several independent selections; a native radio group allows one selection. Use these when the choices should remain visible. Use Select when a compact menu suits the list.
Structure
Section titled “Structure”Each group uses a fieldset and a visible legend. Inside, .field supplies spacing, .field__label styles each visible label and .control sizes the native input and applies color-semantic-accent-primary. Bind labels with matching for and unique id values. The specimen wraps each input in its label so the whole row activates it.
Associate .field__help with the fieldset and its inputs through aria-describedby. Checkbox values are independent. Radio inputs share one name, have distinct values and at most one initial checked attribute. Use a different name for every separate radio group.
Layout and states
Section titled “Layout and states”The local CSS only arranges the specimen. Label rows have a minimum height derived from space-lg plus space-3xs, currently 44px, and fill their column. Labels wrap, controls keep their native size, and the groups stack at narrow widths. Preserve that label hit area in consuming layouts.
Both groups demonstrate selected, unselected and native disabled controls. Explain unavailable choices in visible text. Disabled choices cannot activate, skip keyboard focus and are excluded from form data. Keep the native disabled appearance; do not substitute aria-disabled or a custom widget.
Keyboard and preview limits
Section titled “Keyboard and preview limits”Tab reaches enabled checkboxes and the radio group. Space toggles a checkbox; arrow keys move the radio selection and skip disabled options. The shared focus rule provides the token outline. Labels, legends and native inputs supply semantics without additional roles or scripted keys.
This HTML/CSS preview does not validate or submit. Native selection works, but no export or file upload is connected. Consumers provide validation, state changes, announcements and submission handling.