Classes
Classes#
The struct Classes can be used to deal with HTML classes.
When pushing a string to the set, Classes ensures that there is one element for every class even if a single string might contain multiple classes.
Classes can also be merged by using Extend (i.e. classes1.extend(classes2)) or push() (i.e. classes1.push(classes2)). Any type that implements Into<Classes> can be pushed onto an existing Classes.
The macro classes! is a convenient macro that creates one single Classes. Its input accepts a comma-separated list of expressions. The only requirement is that every expression implements Into<Classes>.
- Literal
- Multiple
- String
- Optional
- Vector
- Array
use ;
html! ;
use ;
html! ;
use ;
let my_classes = Stringfrom;
html! ;
use ;
html! ;
use ;
html! ;
use ;
html! ;
Components that accept classes#
use *;