Radio Group

A set of checkable buttons—known as radio buttons—where no more than one of the buttons can be checked at a time.

Anatomy

Import all parts and piece them together.

use leptos::prelude::*;
use singlestage::radio::*;

#[component]
pub fn RadioAnatomy() -> impl IntoView {
    view! {
        <RadioGroup>
            <Radio />
        </RadioGroup>
    }
}

API Reference

Radio

An item in the group that can be checked.

Custom Attributes
NameTypeDefaultDescription
checkedReactive<bool>false

A reactive signal coupled to the radio button's checked value.

Implements global, input, and radio attributes.

RadioGroup

Contains all the parts of a radio group.

Custom Attributes
NameTypeDefaultDescription
defaultString""

Set or update the default selected value for the RadioGroup.

invalidboolfalse

A reactive signal that toggles whether all the children Radios appear invalid or not.

valueReactive<String>""

A reactive value coupled to the currently selected Radio's value.

Implements global and fieldset attributes.