Getting Started
Style native Rust Iced widgets with compile-time validated Tailwind CSS v4 utility classes (tw!()) or strongly typed Rust builders (iss::typed::*).
1. Install ISS
Section titled “1. Install ISS”iss 0.2 targets Iced 0.14. Add iced and iss to your Cargo.toml, or run cargo add iced iss.
[dependencies]iced = "0.14"iss = "0.2"Cargo Features
Section titled “Cargo Features”Default features enable both wgpu and tiny-skia so gradients, frosted glass (backdrop-blur-*), masks, and filters work out of the box.
| Feature | Included by Default | What It Enables |
|---|---|---|
default (wgpu + tiny-skia) |
Yes | GPU rendering plus frosted glass (backdrop-blur-*), blur filters, blend modes, CSS masks, and rounded child clipping |
wgpu |
Yes | Minimal GPU-only build (default-features = false, features = ["wgpu"]) if your app does not need blur or masks |
tiny-skia |
Yes | Software renderer (default-features = false, features = ["tiny-skia"]) for CPU-only, headless, or WebAssembly builds |
2. Style Your First Widget
Section titled “2. Style Your First Widget”Import TwExt and call .tw(...) directly on built-in Iced widgets (container, text, button, text_input, checkbox, scrollable). Hover and click Unlock below to test the live Iced widget in your browser.
Interactive Iced
Rust · WASM
use iced::widget::{button, container, text};use iss::{col_tw, row_tw, tw, TwExt};
#[derive(Clone)]enum Message { ToggleLock,}
fn view<'a>(unlocked: bool) -> iced::Element<'a, Message> { let status = if unlocked { text("Unlocked · 48 items").tw(tw!("text-xs font-medium text-[#f5d0fe]")) } else { text("Locked · 48 items").tw(tw!("text-xs text-[#a5a0b8]")) };
let action = if unlocked { button(text("Lock").tw(tw!("text-sm font-semibold text-[#f2f0f7]"))) .on_press(Message::ToggleLock) .tw(tw!("px-4 py-2 bg-[#2a2442] hover:bg-[#362e54] active:bg-[#221d36] border border-violet-400/35 rounded-xl cursor-pointer")) } else { button(text("Unlock").tw(tw!("text-sm font-semibold text-white"))) .on_press(Message::ToggleLock) .tw(tw!("px-4 py-2 bg-violet-600 hover:bg-violet-500 active:bg-violet-700 rounded-xl shadow-lg shadow-violet-600/35 cursor-pointer")) };
container(row_tw( [ col_tw([text("Vault").tw(tw!("text-base font-bold text-[#f2f0f7]")), status], tw!("gap-0.5")), action, ], tw!("w-full items-center justify-between gap-3.5"), )) .tw(if unlocked { tw!("w-[412px] p-5 bg-[#1a1826] border border-violet-400/40 rounded-2xl shadow-2xl") } else { tw!("w-[412px] p-5 bg-[#1a1826] border border-white/10 rounded-2xl shadow-2xl") })}use iced::widget::{button, container, text};use iss::typed::*;
#[derive(Clone)]enum Message { ToggleLock,}
fn view<'a>(unlocked: bool) -> iced::Element<'a, Message> { let card = IssStyle::new() .w_px(412.0) .p(5) .bg(IssColor::hex(0x1a1826)) .border() .border_color(if unlocked { palette::VIOLET_400.alpha(0.4) } else { palette::WHITE.alpha(0.1) }) .rounded_2xl() .shadow_2xl();
let btn_style = if unlocked { IssStyle::new() .px(4) .py(2) .bg(IssColor::hex(0x2a2442)) .hover(|s| s.bg(IssColor::hex(0x362e54))) .active(|s| s.bg(IssColor::hex(0x221d36))) .border() .border_color(palette::VIOLET_400.alpha(0.35)) .rounded_xl() .cursor_pointer() } else { IssStyle::new() .px(4) .py(2) .bg(palette::VIOLET_600) .hover(|s| s.bg(palette::VIOLET_500)) .active(|s| s.bg(palette::VIOLET_700)) .rounded_xl() .shadow_lg() .shadow_color(palette::VIOLET_600.alpha(0.35)) .cursor_pointer() };
let status = if unlocked { text("Unlocked · 48 items").tw(IssStyle::new().text_xs().font_medium().text_color(IssColor::hex(0xf5d0fe))) } else { text("Locked · 48 items").tw(IssStyle::new().text_xs().text_color(IssColor::hex(0xa5a0b8))) };
container(row_tw( [ col_tw( [ text("Vault").tw(IssStyle::new().text_base().font_bold().text_color(IssColor::hex(0xf2f0f7))), status, ], IssStyle::new().gap(0.5), ), button(text(if unlocked { "Lock" } else { "Unlock" }).tw(IssStyle::new().text_sm().font_semibold().text_color(palette::WHITE))) .on_press(Message::ToggleLock) .tw(btn_style), ], IssStyle::new().w_full().items_center().justify_between().gap(3.5), )) .tw(card)}3. Compile-Time Validation
Section titled “3. Compile-Time Validation”tw!() parses and validates every class name at compile time, so typos fail during cargo check with closest-match suggestions instead of failing silently at runtime.
use iss::{tw, TwStyle};
const CARD: TwStyle = tw!("p-4 bg-zinc-900 border border-zinc-800 rounded-xl shadow-md");
// Compile-time error: unknown Tailwind class 'bg-banana-500'// let bad = tw!("p-4 bg-banana-500");Next Steps
Section titled “Next Steps” Styling Native Widgets Cheat sheet for container, button, text, text_input, checkbox, scrollable, svg, and multi-child layouts.
Reusable Styles & .mix() Share const styles, compose button variants with .mix(), and build clean widget helpers.
Arbitrary Values & Escape Hatches Use exact pixels, hex colors, calc(), opacity modifiers, and raw Iced overrides.
Browse Utilities Look up any Tailwind CSS v4 utility class and its iss::typed equivalent.