thaw/demo_markdown/docs/input_number/mod.md

57 lines
1.5 KiB
Markdown
Raw Normal View History

2024-01-02 21:08:21 +08:00
# Input Number
```rust demo
let value = create_rw_signal(0);
let value_f64 = create_rw_signal(0.0);
view! {
<Space vertical=true>
<InputNumber value step=1/>
<InputNumber value=value_f64 step=1.0/>
</Space>
}
```
### Disabled
```rust demo
let value = create_rw_signal(0);
view! {
<InputNumber value step=1 disabled=true/>
}
```
### Invalid
```rust demo
let value = create_rw_signal(0);
view! {
<InputNumber value step=1 invalid=true/>
}
```
### InputNumber Props
| Name | Type | Default | Description |
| --- | --- | --- | --- |
2024-02-09 22:44:22 +08:00
| class | `OptionalProp<MaybeSignal<String>>` | `Default::default()` | Addtional classes for the input element. |
| value | `Model<T>` | `T::default()` | Set the input value. |
| placeholder | `OptionalProp<MaybeSignal<String>>` | `Default::default()` | Placeholder of input number. |
2024-01-02 21:08:21 +08:00
| step | `MaybeSignal<T>` | | The number which the current value is increased or decreased on key or button press. |
| disabled | `MaybeSignal<bool>` | `false` | Whether the input is disabled. |
| invalid | `MaybeSignal<bool>` | `false` | Whether the input is invalid. |
| attr: | `Vec<(&'static str, Attribute)>` | `Default::default()` | The dom attrs of the input element inside the component. |
#### T impl
`T: Add<Output = T> + Sub<Output = T> + Default + Clone + FromStr + ToString + 'static`
### InputNumber Ref
| Name | Type | Description |
| ----- | ----------- | ------------------------ |
| focus | `Fn(&self)` | Focus the input element. |
2024-02-09 22:44:22 +08:00
| blur | `Fn(&self)` | Blur the input element. |