Skip to content

Commit 4bb2ffe

Browse files
committed
add value prop to Switch
1 parent edbfe52 commit 4bb2ffe

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

thaw/src/switch/docs/mod.md

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ view! {
1515
| class | `MaybeProp<String>` | `Default::default()` | |
1616
| id | `MaybeProp<String>` | `Default::default()` | |
1717
| name | `MaybeProp<String>` | `Default::default()` | A string specifying a name for the input control. This name is submitted along with the control's value when the form data is submitted. |
18+
| value | `MaybeProp<String>` | `Default::default()` | A string specifying the value for the input control. |
1819
| rules | `Vec<SwitchRule>` | `vec![]` | The rules to validate Field. |
1920
| checked | `Model<bool>` | `false` | Defines the controlled checked state of the Switch. |
2021
| label | `MaybeProp<String>` | `Default::default()` | The Switch's label. |

thaw/src/switch/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ pub fn Switch(
1111
/// This name is submitted along with the control's value when the form data is submitted.
1212
#[prop(optional, into)]
1313
name: MaybeProp<String>,
14+
/// A String specifying the value of the input control.
15+
#[prop(optional, into)]
16+
value: MaybeProp<String>,
1417
/// The rules to validate Field.
1518
#[prop(optional, into)]
1619
rules: Vec<SwitchRule>,
@@ -49,6 +52,7 @@ pub fn Switch(
4952
type="checkbox"
5053
id=id
5154
name=name
55+
value=move || value.get()
5256
checked=checked.get_untracked()
5357
prop:checked=move || { checked.get() }
5458
node_ref=input_ref

0 commit comments

Comments
 (0)