Replies: 1 comment
-
Here's an example with three different ways to do what you're asking. Take your pick! let index = RwSignal::new(0);
let i = 0;
let condition = move || index.get() == i;
view! {
<div class=(["active", "dark"], move || index.get() == i)></div>
<div class:active=condition class:dark=condition></div>
<div class=move || (index.get() == i).then_some("active dark")></div>
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I can include some class conditionally, kinda:
But for multiple classes with same condition I must repeat the condition over and over:
Wouldn't it be useful to specify multiple classes at once kinda:
I know i can combine classes with CSS, but just wondering, why isn't it supported? Is there any reasons to restrict this?
Beta Was this translation helpful? Give feedback.
All reactions