Conditional Values
Use a conditional value for content or attributes whose value changes at runtime. Its condition must be a parenthesized Rust expression, followed by ?, the value for true, and the value for false. Style values are compile-time CSS and cannot be conditional.
Link {
text: (request.page == "docs") ? "Current documentation" : "Documentation"
href: (request.page == "docs") ? "#content" : "/docs"
}
Both result values must be valid for the content or attribute property. Use an if statement when styles or the component tree need to change.
Text {
text: (user.is_admin) ? "Administrator" : "Member"
}