pub struct RadioButtonProps {Show 13 fields
pub id: String,
pub name: Option<String>,
pub value: Option<String>,
pub checked: bool,
pub disabled: bool,
pub label: String,
pub children: Element,
pub color: Color,
pub outline: bool,
pub size: Size,
pub autocomplete: Option<String>,
pub class: String,
pub onchange: Option<EventHandler<FormEvent>>,
/* private fields */
}Expand description
Bootstrap radio toggle button (btn-check).
Bootstrap 5.3’s “Radio toggle buttons” — the radio sibling of
CheckboxButton, and the markup behind a segmented button group: several
radios sharing one name, each with its own label, wrapped in a
ButtonGroup.
§Bootstrap HTML → Dioxus
| HTML | Dioxus |
|---|---|
<input class="btn-check" type="radio" name="view" id="r1"><label class="btn btn-primary" for="r1">List</label> | RadioButton { id: "r1", name: "view", label: "List" } |
rsx! {
ButtonGroup {
RadioButton { id: "v-list", name: "view", value: "list", label: "List", checked: true }
RadioButton { id: "v-grid", name: "view", value: "grid", label: "Grid" }
}
}Fields§
§id: StringThe input’s id and the label’s for target. Required, as for
CheckboxButton.
name: Option<String>The radio group name. Radios sharing a name are mutually exclusive —
which is the whole point of a radio, so this is where a segmented
control is actually defined.
value: Option<String>The value submitted when this option is selected.
checked: boolWhether this option is selected.
disabled: boolDisable the control.
label: StringThe visible text, rendered after any children.
children: ElementRich label content, rendered inside the label before label.
color: ColorButton colour variant.
outline: boolUse the outline style.
size: SizeButton size.
autocomplete: Option<String>§class: StringAdditional CSS classes, appended to the label’s button classes.
onchange: Option<EventHandler<FormEvent>>Change handler, fired on the input.
Implementations§
Source§impl RadioButtonProps
impl RadioButtonProps
Sourcepub fn builder() -> RadioButtonPropsBuilder<((), (), (), (), (), (), (), (), (), (), (), (), (), ())>
pub fn builder() -> RadioButtonPropsBuilder<((), (), (), (), (), (), (), (), (), (), (), (), (), ())>
Create a builder for building RadioButtonProps.
On the builder, call .id(...), .name(...)(optional), .value(...)(optional), .checked(...)(optional), .disabled(...)(optional), .label(...)(optional), .children(...)(optional), .color(...)(optional), .outline(...)(optional), .size(...)(optional), .autocomplete(...)(optional), .class(...)(optional), .onchange(...)(optional), .attributes(...)(optional) to set the values of the fields.
Finally, call .build() to create the instance of RadioButtonProps.
Trait Implementations§
Source§impl Clone for RadioButtonProps
impl Clone for RadioButtonProps
Source§fn clone(&self) -> RadioButtonProps
fn clone(&self) -> RadioButtonProps
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more