#css-in-rust #css #yew

stylist

Stylist is a CSS-in-Rust styling solution for WebAssembly Applications

14 releases (9 breaking)

0.15.1 Mar 18, 2026
0.14.0 Feb 15, 2026
0.13.0 Oct 6, 2023
0.12.1 Jun 25, 2023
0.9.2 Sep 15, 2021

#61 in WebAssembly

Download history 7304/week @ 2025-12-31 26533/week @ 2026-01-07 24373/week @ 2026-01-14 30470/week @ 2026-01-21 34220/week @ 2026-01-28 35444/week @ 2026-02-04 32728/week @ 2026-02-11 34279/week @ 2026-02-18 34935/week @ 2026-02-25 33232/week @ 2026-03-04 39809/week @ 2026-03-11 29112/week @ 2026-03-18 19569/week @ 2026-03-25 2349/week @ 2026-04-01 12151/week @ 2026-04-08 5542/week @ 2026-04-15

43,432 downloads per month
Used in 18 crates (16 directly)

MIT license

155KB
3.5K SLoC

Stylist

Run Tests & Publishing crates.io download docs.rs

Stylist is a CSS-in-Rust styling solution for WebAssembly Applications.

This is a fork of css-in-rust.

Install

Add the following to your Cargo.toml:

stylist = "0.14"

Usage

For detailed usage, please see documentation.

Yew Integration

To style your component, you can use styled_component attribute with css! macro.

use yew::prelude::*;
use stylist::yew::styled_component;

#[styled_component]
fn MyStyledComponent() -> Html {
    html! {<div class={css!("color: red;")}>{"Hello World!"}</div>}
}

Standalone

To create a stylesheet, you can use style!:

use stylist::style;

let style = style!(
   // A CSS string literal
   r#"
       background-color: red;

       .nested {
           background-color: blue;
           width: 100px
       }
   "#
).expect("Failed to mount style");

// stylist-uSu9NZZu
println!("{}", style.get_class_name());

Runtime Style

If you want to parse a string into a style at runtime, you can use Style::new:

use stylist::Style;

let style_str = r#"
    background-color: red;

    .nested {
        background-color: blue;
        width: 100px
    }
"#;

let style = Style::new(style_str).expect("Failed to create style");

// stylist-uSu9NZZu
println!("{}", style.get_class_name());

Theming

There's theming example using Yew Context API.

Dependencies

~7–13MB
~215K SLoC