Radio

ds-radio wraps a native input type="radio". The browser owns grouping, Arrow and Space keys, labels, required validation, form values, reset and disabled fieldsets. Radios in one group share a name; separate groups need distinct names. DS1 owns the face, focus ring, disabled state and scale.

<fieldset><legend>Access</legend>  <label><ds-radio><input type="radio" name="access" value="all" checked></ds-radio>All projects</label>  <label><ds-radio><input type="radio" name="access" value="selected"></ds-radio>Selected projects</label></fieldset>

The standard control is one square in each direction. choice presents the same native radio as a labelled choice, four squares wide and one high. compact makes it one square wide. preview adds a two-row preview above the label; put product artwork in the preview slot. Always give the native input an accessible name; the decorative face is hidden from assistive technology.

<ds-radio choice preview label="Grid">  <input type="radio" name="pattern" value="grid" aria-label="Grid">  <span slot="preview">Product artwork</span></ds-radio>

In React, put the native input inside ds-radio; its props and ref belong to the input. Put decorative React content in the preview slot. Register ds-radio in the browser before hydrating, and use React useId() for independent groups that can mount more than once.

<ds-radio choice label="Grid">  <input type="radio" name={groupName} value="grid" aria-label="Grid"    checked={pattern === "grid"} onChange={() => setPattern("grid")} />  <span slot="preview"><PatternPreview pattern="grid" /></span></ds-radio>

Products keep choice data, preview artwork, selection decisions and persistence. Remove replaced selection, focus and control face CSS. Do not recreate radio keyboard logic or move native inputs into separate shadow roots. Check accepted and declined controlled edits, required forms, reset, labels, multiple groups, disabled fieldsets, narrow layouts and independent surface scales.

Choose an edition

A single selection, arranged on one-square rows.

Choices with a preview

A native radio group under labelled faces. The arrow keys move the choice.

The native input does everything assistive technology meets: its name, its group, its checked state and its keys. Focus shows as a 2px ring. Calling focus() on ds-radio moves focus to the input. A label on a choice is drawn in a face hidden from assistive technology, so name the input too, with aria-label or a label. Words that do not fit fade over their last square.

AttributeTypeDefaultWhat it does
choicebooleanfalseA labelled choice four squares wide and one high.
compactbooleanfalseWith choice, one square wide.
previewbooleanfalseWith choice, adds the preview and stands three squares high.
labelstringEmptyThe words on a choice.
SlotWhat it holds
DefaultOne native input type="radio".
previewThe artwork above the label.

It has no events or tokens of its own: listen to the input’s change, and set name, value, checked, required and disabled on the input. Add hidden to hide it. Copy radio through Sync 1. On Apple platforms it is DS1Radio, or DS1Choice for a labelled choice.