Need a way to style a components children in Yew #35
Answered
by
WorldSEnder
Madoshakalaka
asked this question in
Q&A
-
Beta Was this translation helpful? Give feedback.
Answered by
WorldSEnder
Sep 2, 2021
Replies: 2 comments
-
The following example seems to work for me let children = (0..5).map(|i| html! {<li><span>{format!("Item: {}", i)}</span></li>});
let container = css!(
r#"
display: grid;
& li {
color: green;
}"#
);
html! {
<div class=self.style()>
<ul class={container}>
{for children}
</ul>
</div>
} This applies the |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
WorldSEnder
-
@WorldSEnder I....forgot we are writing sass and things are nestable...Thanks!!! That helps a ton! |
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
The following example seems to work for me
This applies the
display: grid
to the<ul>
item, and thecolor: green
to the individual children. Can you post the css you tried? If you used inline style, it might have to do with spacing issues.