2023-12-31 23:33:05 +08:00
|
|
|
# Select
|
|
|
|
|
|
|
|
```rust demo
|
2024-07-07 18:33:45 +08:00
|
|
|
let value = RwSignal::new(None::<String>);
|
2023-12-31 23:33:05 +08:00
|
|
|
|
|
|
|
let options = vec![
|
2024-04-23 09:41:01 +08:00
|
|
|
SelectOption::new("RwSignal", String::from("rw_signal")),
|
|
|
|
SelectOption::new("Memo", String::from("memo")),
|
2023-12-31 23:33:05 +08:00
|
|
|
];
|
|
|
|
|
|
|
|
view! {
|
2024-04-23 09:41:01 +08:00
|
|
|
<Select value options />
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
# Multiple Select
|
|
|
|
|
|
|
|
```rust demo
|
2024-07-07 18:33:45 +08:00
|
|
|
let value = RwSignal::new(vec![
|
2024-04-23 09:41:01 +08:00
|
|
|
"rust".to_string(),
|
|
|
|
"javascript".to_string(),
|
|
|
|
"zig".to_string(),
|
|
|
|
"python".to_string(),
|
|
|
|
"cpp".to_string(),
|
|
|
|
]);
|
|
|
|
|
|
|
|
let options = vec![
|
|
|
|
MultiSelectOption::new("Rust", String::from("rust")).with_variant(TagVariant::Success),
|
|
|
|
MultiSelectOption::new("JavaScript", String::from("javascript")),
|
|
|
|
MultiSelectOption::new("Python", String::from("python")).with_variant(TagVariant::Warning),
|
|
|
|
MultiSelectOption::new("C++", String::from("cpp")).with_variant(TagVariant::Error),
|
|
|
|
MultiSelectOption::new("Lua", String::from("lua")),
|
|
|
|
MultiSelectOption::new("Zig", String::from("zig")),
|
|
|
|
];
|
|
|
|
|
|
|
|
view! {
|
|
|
|
<MultiSelect value options />
|
2023-12-31 23:33:05 +08:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### Select Props
|
|
|
|
|
|
|
|
| Name | Type | Default | Description |
|
|
|
|
| ------- | ----------------------------------- | -------------------- | ----------------------------------------- |
|
2024-02-09 22:44:22 +08:00
|
|
|
| class | `OptionalProp<MaybeSignal<String>>` | `Default::default()` | Addtional classes for the select element. |
|
|
|
|
| value | `Model<Option<T>>` | `None` | Checked value. |
|
2023-12-31 23:33:05 +08:00
|
|
|
| options | `MaybeSignal<Vec<SelectOption<T>>>` | `vec![]` | Options that can be selected. |
|
2024-04-23 09:41:01 +08:00
|
|
|
|
|
|
|
### Multiple Select Props
|
|
|
|
|
|
|
|
| Name | Type | Default | Description |
|
|
|
|
| --------- | ----------------------------------- | -------------------- | ----------------------------------------- |
|
|
|
|
| class | `OptionalProp<MaybeSignal<String>>` | `Default::default()` | Addtional classes for the select element. |
|
|
|
|
| value | `Model<Vec<T>>` | `vec![]` | Checked values. |
|
|
|
|
| options | `MaybeSignal<Vec<SelectOption<T>>>` | `vec![]` | Options that can be selected. |
|
|
|
|
| clearable | `MaybeSignal<bool>` | `false` | Allow the options to be cleared. |
|
|
|
|
|
|
|
|
### Select Slots
|
|
|
|
|
|
|
|
| Name | Default | Description |
|
|
|
|
| ----------- | ------- | ------------- |
|
|
|
|
| SelectLabel | `None` | Select label. |
|