Aliases
radio buttons
components / radiogroup
Data-driven single-selection group with native radio semantics and predictable grouped layout.
Playground
Start here. Switch systems, interact with the shipped component, and let the rest of the page answer the why and how after the behavior clicks.
Cobalt
The crisp default DK action system: bright primary, roomy spacing, and a direct editorial rhythm.
Overview
This section explains the intent of the component before the implementation details.
Aliases
radio buttons
Explore the math
Decision guide
Use these notes to decide quickly whether this is the right DK component for the job.
Decision guide
Do
Do not
Usage
Prefer these situations when choosing this component.
Usage
These patterns are better served by a different component or a simpler surface.
Anti-patterns
Migration notes
Anatomy
The anatomy explains which pieces matter to the recipe and accessibility model.
radio group
groupWraps the full set of mutually exclusive choices.
single radio option
itemEach selectable option with label and optional description.
API
The docs contract distinguishes props, DOM events, and slots so integration behavior is explicit.
Props
| Name | Type | Default | Description |
|---|---|---|---|
value | string | — | Controlled selected value. |
items | Array<{ value: string; label: string; description?: string; disabled?: boolean }> | — | Available radio options. |
orientation | 'vertical' | 'horizontal' | 'vertical' | Chooses how the options are laid out. |
label | string | — | Visible group label. |
description | string | — | Supporting helper copy for the full group. |
error | string | — | Problem copy for validation or blocked flows. |
required | boolean | false | Marks the group as required. |
disabled | boolean | false | Disables the whole group. |
name | string | — | Native radio group name. |
size | 'sm' | 'md' | 'md' | Chooses the size recipe. |
onChange | (detail: { value: string | undefined }) => void | — | Callback fired when selection changes. |
theme | ThemeContract | — | Overrides the compiled DK theme used to resolve tokens and recipes for this component. |
Events
| Name | Payload | Description |
|---|---|---|
change | { value: string | undefined } | Fires when the component commits a new value. |
Slots
| Name | Description |
|---|---|
default | RadioGroup is data-driven in v1 and does not expose option slots. |
Recipes
These notes summarize the intended recipe surface rather than exposing raw implementation detail first.
Variants
Sizes
States
Accessibility
This is the behavior the component promises to assistive tech and keyboard users today.
Semantics
Keyboard
Screen readers
Checklist
Implementation
This section shows the representative compiled slot variables that the runtime consumes for the selected design system.
Implementation notes
Implementation checklist
Examples
Each example is intentionally practical, grouped by starter, common pattern, and edge-case coverage.
Starter
1 example
starter
Starter: cadence selectionA small mutually exclusive option set.
Copy snippet
<RadioGroup label="Digest cadence" items={cadenceItems} value="daily" />Common patterns
1 example
common
Common: compact horizontal setHorizontal orientation fits short labels.
Copy snippet
<RadioGroup orientation="horizontal" items={sizeItems} value="md" />Edge cases
1 example
edge
Edge: explained optionsDescriptions help when the options are subtle.
Copy snippet
<RadioGroup label="Review cadence" items={[{ value: 'daily', label: 'Daily', description: 'Fast status rhythm.' }, { value: 'weekly', label: 'Weekly', description: 'Lower-noise update cadence.' }]} />Verification
Proofs stay visible in the docs so the system shows what it can guarantee, not just what it can render.
orientation=vertical|size=sm
orientation=horizontal|size=sm
orientation=vertical|size=md
orientation=horizontal|size=md
orientation=vertical|size=lg
orientation=horizontal|size=lg
orientation=vertical|size=sm
orientation=horizontal|size=sm
orientation=vertical|size=md
orientation=horizontal|size=md
orientation=vertical|size=lg
orientation=horizontal|size=lg