This is unreleased documentation for Yew Next version.
For up-to-date documentation, see the latest version on docs.rs.
yew::prelude

Macro classes

Source
classes!() { /* proc-macro */ }
Expand description

This macro provides a convenient way to create Classes.

The macro takes a list of items similar to the vec! macro and returns a Classes instance. Each item can be of any type that implements Into<Classes> (See the implementations on Classes to learn what types can be used).

ยงExample

let conditional_class = Some("my-other-class");
let vec_of_classes = vec![
    "one-bean",
    "two-beans",
    "three-beans",
    "a-very-small-casserole",
];

html! {
    <div class={classes!("my-container-class", conditional_class, vec_of_classes)}>
        // ...
    </div>
};