1. Reference
  2. Forms and input

<radio-group>

Holds a set of radios as one choice, published as a variable named by name=.

Forms and input

This tag has more than one name. Every spelling is the same tag, so write whichever feels natural. Pick one and every example on this page uses it.

radio-group.ham
<column style="w-full gap-8">
    <text style="font-semibold">Plan</text>
    <radio-group id="plan"
                 name="plan">
        <radio value="monthly"
               color="teal-600"
               label="Monthly, $9"
               selected="true"/>
        <radio value="yearly"
               color="teal-600"
               label="Yearly, $90"/>
    </radio-group>
    <text @text="'Chosen: ' + #plan.label"
          style="muted"></text>
</column>
The snippet drawn by Hype Apps on a phone, in light mode The snippet drawn by Hype Apps on a phone, in dark mode
This snippet as Hype Apps draws it on a phone. It follows this page's light or dark theme.

Attributes

NameWhat it doesDefault
name Variable name for form scoping
string

Readings

NameWhat it does
count How many options the control offers.
index The selected option's position, from 0; -1 when none.
label The selected option's text; empty when none is selected.
value The selected option's value; empty when none is selected.

Any tag also takes gestures: @on.tap, @on.longpress, @on.doubletap and @on.swipeleft (and right, up and down). @click runs on a tap too.

This page is also Markdown, and all of HAM is in llms.txt.