DioxusLabs / DioxusLabs/dioxus
Implement multiple optional attributes for components
- Dominant language
- Rust
- Stars
- 39.1k
- Forks
- 1.9k
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 4
Description
## Feature Request
Multiple optional attributes are supported for html elements but it doesn't support for components. This will allow us to initialize attributes conditionaly.
```rs
#[component]
pub fn Text(#[props(optional)] class: String, #[props(optional)] children: Element) -> Element {
rsx! {
label {
class: "w-full text-white",
class: class,
{children}
}
}
}
pub fn Page() -> Element {
let mut my_signall: Signal> = use_signal(|| None);
rsx! {
Text {
class: "cursor-pointer",
class: if {my_signall.read().is_some()} { "text-green-600"}
"Content"
}
}
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.