2023-12-31 23:33:05 +08:00
|
|
|
# Radio
|
|
|
|
|
|
|
|
```rust demo
|
2024-05-23 14:48:06 +08:00
|
|
|
let value = RwSignal::new(None);
|
2024-02-25 17:13:13 +08:00
|
|
|
|
|
|
|
view! {
|
|
|
|
<RadioGroup value>
|
2024-05-23 14:48:06 +08:00
|
|
|
<Radio value="a" label="Apple"/>
|
|
|
|
<Radio value="o" label="Orange"/>
|
2024-02-25 17:13:13 +08:00
|
|
|
</RadioGroup>
|
|
|
|
<div style="margin-top: 1rem">
|
|
|
|
"value: " {move || format!("{:?}", value.get())}
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2023-12-31 23:33:05 +08:00
|
|
|
### Radio Props
|
|
|
|
|
2024-02-09 22:44:22 +08:00
|
|
|
| Name | Type | Default | Description |
|
|
|
|
| -------- | ----------------------------------- | -------------------- | ---------------------------------------- |
|
|
|
|
| class | `OptionalProp<MaybeSignal<String>>` | `Default::default()` | Addtional classes for the radio element. |
|
|
|
|
| value | `Model<bool>` | `false` | Checked value. |
|
2024-02-25 17:13:13 +08:00
|
|
|
| children | `Option<Children>` | `None` | Radio's content. |
|
|
|
|
|
|
|
|
### RadioGroup Props
|
|
|
|
|
|
|
|
| Name | Type | Default | Description |
|
|
|
|
| -------- | ----------------------- | -------------------- | ---------------------------------- |
|
|
|
|
| value | `Model<Option<String>>` | `Default::default()` | Sets the value of the radio group. |
|
|
|
|
| children | `Children` | | RadioGroup's content. |
|
|
|
|
|
|
|
|
### RadioItem Props
|
|
|
|
|
|
|
|
| Name | Type | Default | Description |
|
|
|
|
| --- | --- | --- | --- |
|
|
|
|
| class | `OptionalProp<MaybeSignal<String>>` | `Default::default()` | Addtional classes for the radio element. |
|
|
|
|
| key | `String` | | The key of the radio to be used in a radio group. |
|
|
|
|
| children | `Option<Children>` | `None` | Radio's content. |
|