KANTO DS v1.12.0
Customise

Theme

Accent

Font

Corners

Density

Text size

Reset to Kanto
Forms

kt-radio-group

GitHub Copy link

One choice among a few, all visible at once. The options are <kt-radio> children.

Preview

Monthly Yearly — two months free Custom contract

One choice among a few, all visible at once. The options are <kt-radio> children.

<kt-radio-group label="Billing" name="billing" value="monthly"> <kt-radio value="monthly">Monthly</kt-radio> <kt-radio value="yearly">Yearly — two months free</kt-radio> <kt-radio value="custom" disabled>Custom contract</kt-radio> </kt-radio-group>

Radio group, select or segmented control

  • Radio group — few enough options to show them all, and seeing them side by side helps the choice. Options can be a sentence long.
  • <kt-select> — more options than fit, or the choice is minor.
  • <kt-segmented-control> — two to five short options in a toolbar, such as a view switch.

Keyboard

Native radios cannot form a group across shadow roots, so this is the ARIA radio group pattern — the one a screen reader expects:

KeyDoes
TabEnters and leaves the group: one tab stop for all of it
↓ / →Next option, and selects it
↑ / ←Previous option, and selects it
SpaceSelects the focused option

The arrows wrap at the ends and skip disabled options. The tab stop sits on the chosen option, or on the first enabled one while nothing is chosen.

In a form

A form control: it submits the chosen value under name, and nothing while none is chosen. required blocks submission until an option is chosen, error shows a message and marks every option, and form.reset() puts back the initial value.

API

<kt-radio-group>

PropertyAttributeTypeDefault
valuevaluestring | nullnull
namenamestring''
labellabelstring''
disableddisabledbooleanfalse
requiredrequiredbooleanfalse
orientationorientation'vertical' | 'horizontal''vertical'
errorerrorstring''

<kt-radio>

PropertyAttributeTypeDefault
valuevaluestring''
disableddisabledbooleanfalse
EventDetail
kt-change{ value: string | null }
PartElementDescription
basekt-radio-groupThe role="radiogroup" box
basekt-radioThe role="radio" row
circlekt-radioThe drawn circle