Via #10 / #309. In Ractive, you could do this:
<label>
<input type="radio" value="Alpha" name='{{selected}}' />Alpha
</label>
<label>
<input type="radio" value="Beta" name='{{selected}}' />Beta
</label>
<label>
<input type="radio" value="Gamma" name='{{selected}}' />Gamma
</label>
<p>selected: {{selected}}</p>
The name='{{selected}}' sort of makes sense, in that a shared name identifies the radios as belonging to the same group, but only sort of, since you're not actually binding to the name.
A possible alternative — keen to hear what people think:
<label>
<input type="radio" value="Alpha" name='whatever' bind:group='selected' />Alpha
</label>
In other words, selected would take the value of whichever radio in the group of those with name='whatever' was checked.
Via #10 / #309. In Ractive, you could do this:
The
name='{{selected}}'sort of makes sense, in that a sharednameidentifies the radios as belonging to the same group, but only sort of, since you're not actually binding to the name.A possible alternative — keen to hear what people think:
In other words,
selectedwould take the value of whichever radio in the group of those withname='whatever'was checked.