Community project. This is not an official government website.

Run by volunteers. Lampung Design System is built by an open source community. No government agency runs or endorses it.

Official services use go.id. Government websites in Indonesia end in .go.id. Never enter your national ID number on a site you are unsure of.

Radio

Radio

Native radio buttons for exactly one choice out of two to five options that should all be visible. The dot springs in; arrow keys move between options.

Usage

Use it when

  • One answer from a short list where seeing every option helps: delivery method, exam session, answer options in a question.
  • Options are mutually exclusive and need a word or a line of explanation each.

Use something else when

  • Each option is a richer choice with a description, price or badge (plans, packages): use Radio card.
  • More than about five options, or space is tight: use Select.
  • A long list people type to find: use Combobox.
  • Switching a view or setting that applies immediately (Day, Week, Month): use Segmented control.
  • Several options can be on at once: use Checkbox.
  • A single on and off setting: use Switch.

Where it goes. In a form, stacked in a column 12 px apart inside a <fieldset> with a <legend> that asks the question. Two short options may sit side by side on wide screens; stack them on phones.

Examples

Delivery methodClick an option or focus the group and use the arrow keys. The dot springs in; the old one shrinks out faster.
Where should we send your results?
<fieldset class="stack" style="border: 0;">
  <legend class="field__label" style="margin-bottom: 12px;">Where should we send your results?</legend>
  <label class="check"><input type="radio" name="rd-del" checked><span class="radio__dot" aria-hidden="true"></span><span class="check__text">Email<small>siti@campus.ac.id</small></span></label>
  <label class="check"><input type="radio" name="rd-del"><span class="radio__dot" aria-hidden="true"></span><span class="check__text">Push notification<small>On the phone you signed in with</small></span></label>
  <label class="check"><input type="radio" name="rd-del"><span class="radio__dot" aria-hidden="true"></span><span class="check__text">Both</span></label>
</fieldset>
Answer options in a questionExam answers are radios: one answer, all visible, keyboard friendly. A disabled option stays readable.
Which number continues the series 2, 6, 12, 20, …?
<fieldset class="stack" style="border: 0; max-width: 520px;">
  <legend class="field__label" style="margin-bottom: 12px;">Which number continues the series 2, 6, 12, 20, …?</legend>
  <label class="check"><input type="radio" name="rd-q"><span class="radio__dot" aria-hidden="true"></span><span class="check__text">A. 26</span></label>
  <label class="check"><input type="radio" name="rd-q"><span class="radio__dot" aria-hidden="true"></span><span class="check__text">B. 28</span></label>
  <label class="check"><input type="radio" name="rd-q" checked><span class="radio__dot" aria-hidden="true"></span><span class="check__text">C. 30</span></label>
  <label class="check"><input type="radio" name="rd-q" disabled><span class="radio__dot" aria-hidden="true"></span><span class="check__text">D. 32</span></label>
</fieldset>

Anatomy

PartWhat it is
fieldset + legendRequired. The question ("Where should we send your results?").
label.checkRequired. One option; the whole row is the hit area.
input[type=radio][name]Required. The native radio, invisible over the dot; one shared name per group.
.radio__dotRequired. The 22 px circle; checked fills accent with a white 8 px dot. aria-hidden.
.check__textRequired. The option text; a small inside adds a second line.

States

StateHow
checkedAccent fill with the primary finish; white center dot.
hoverEdge darkens to --text-subtle.
:activeThe dot sinks to 0.88 in 90 ms.
focus-visibleFocus ring around the dot.
disabledNative disabled; style the text yourself only if needed. Say why in a second line.

Motion and microinteractions

  • Selecting: the center dot scales 0 to 1 on --spring-snappy (360 ms); the fill and edge change in --d-fast (160 ms). The previous option shrinks its dot in --d-exit (180 ms) on --ease-exit, so the old choice is gone before the new one settles.
  • Press: scale(0.88) in 90 ms, back on --spring-snappy.
  • Reduced motion: transitions become 120 ms linear.

Accessibility

  • Real <input type="radio"> with a shared name: Tab enters the group at the checked option, arrow keys move and select, Space selects.
  • Wrap the group in <fieldset> with a <legend>; the question is read with each option.
  • Preselect a sensible default when one exists, so the group never sits empty without reason; otherwise validate with an error under the group.

Do and don't

Do

  • Order options logically (frequency, size, time).
  • Keep labels short and parallel; put detail in the small line.

Don't

  • Use radios for more than about five options.
  • Make a single radio; one choice that can be undone is a checkbox.
  • Lay several radios out in a wrapping row on phones.