diff --git a/src/view/02_dynamic_attributes.md b/src/view/02_dynamic_attributes.md index c095b6d..c0c1bad 100644 --- a/src/view/02_dynamic_attributes.md +++ b/src/view/02_dynamic_attributes.md @@ -52,10 +52,17 @@ reactively update when the signal changes. Now every time I click the button, the text should toggle between red and black as the number switches between even and odd. -Some CSS class names can’t be directly parsed by the `view` macro, especially if they include a mix of dashes and numbers or other characters. In that case, you can use a tuple syntax: `class=("name", value)` still directly updates a single class. - ```rust -class=("button-20", move || count() % 2 == 1) + ``` > If you’re following along, make sure you go into your `index.html` and add something like this: @@ -68,6 +75,12 @@ class=("button-20", move || count() % 2 == 1) > > ``` +Some CSS class names can’t be directly parsed by the `view` macro, especially if they include a mix of dashes and numbers or other characters. In that case, you can use a tuple syntax: `class=("name", value)` still directly updates a single class. + +```rust +class=("button-20", move || count() % 2 == 1) +``` + ## Dynamic Styles Individual CSS properties can be directly updated with a similar `style:` syntax. @@ -172,7 +185,7 @@ for expensive calculations.
-Code Sandbox Source +CodeSandbox Source ```rust use leptos::*;