Troubleshooting & Compiler Errors
Because tw!() validates every utility class during compilation, most styling bugs show up immediately in cargo check instead of at runtime.
1. Mistyped Classes & did you mean Suggestions
Section titled “1. Mistyped Classes & did you mean Suggestions”When you mistype a utility name, color family, shade, or variant prefix inside tw!("..."), the compiler stops on that exact token and prints the closest valid match:
let bad = tw!("p-4 bg-blu-500"); // compile_fail: typo in color familyerror: tw! error: unknown Tailwind class 'bg-blu-500' (did you mean 'bg-blue-500'?)Variant prefix typos and invalid shades produce targeted hints as well:
error: tw! error: unknown Tailwind class 'hovr:bg-zinc-800' (did you mean 'hover:bg-zinc-800'?)error: tw! error: unknown Tailwind class 'bg-violet-550' (hint: valid Tailwind color shades are 50, 100..900, 950)Note that tw!() expects a single string literal (tw!("p-4 bg-zinc-900")). If you want to split a long style across variables or compose conditional classes, use .mix().
2. Common Tailwind v3 to v4 Renames
Section titled “2. Common Tailwind v3 to v4 Renames”ISS targets Tailwind CSS v4. Several v3 utility names were renamed or replaced in v4:
| Tailwind v3 | Tailwind v4 (Use in ISS) | What ISS Does |
|---|---|---|
bg-opacity-50 / text-opacity-75 |
bg-violet-500/50 / text-white/75 |
Compile error with /alpha migration hint |
flex-shrink-0 / flex-shrink |
shrink-0 / shrink |
Compile error suggesting shrink-0 / shrink |
flex-grow-0 / flex-grow |
grow-0 / grow |
Compile error suggesting grow-0 / grow |
overflow-ellipsis |
text-ellipsis |
Compile error suggesting text-ellipsis |
bg-gradient-to-r |
bg-linear-to-r |
Prefer bg-linear-to-* in v4 (v3 alias also parses) |
shadow / rounded |
shadow-sm / rounded-sm |
Prefer explicit v4 size suffixes (shadow-sm, rounded-sm) |
3. Common Iced Gotchas
Section titled “3. Common Iced Gotchas”Child headers or buttons poke past rounded-* corners
Section titled “Child headers or buttons poke past rounded-* corners”If a card has rounded-2xl and its first child is a flush top bar or full-bleed image, add overflow-hidden to the rounded parent container so ISS clips child corners strictly to the parent’s rounded arc:
use iced::widget::{button, container, text};use iss::{col_tw, tw, TwExt};
let card = container(col_tw( [ button(text("Header").tw(tw!("text-sm text-white"))) .on_press(Message::HeaderClick) .tw(tw!("w-full px-4 py-3 bg-zinc-800 hover:bg-zinc-700")), container(text("Body").tw(tw!("text-sm text-zinc-300"))).tw(tw!("p-4")), ], tw!("w-full"),)).tw(tw!("w-[340px] rounded-2xl overflow-hidden bg-zinc-900 border border-zinc-800"));backdrop-blur-*, blur-*, or mask-* has no visible effect
Section titled “backdrop-blur-*, blur-*, or mask-* has no visible effect”Check two things:
- Cargo features: Keep the default
tiny-skiafeature enabled inCargo.toml(iss = "0.2"). If you setdefault-features = false, features = ["wgpu"], software blur/mask effects fall back gracefully to solid fills. - Translucent background +
isolate:backdrop-blur-xlblurs content behind the card. Make sure the parent stage hasisolate(e.g.stack_tw(..., tw!("isolate ..."))) and the glass card uses a translucent background likebg-[#120f1d]/65instead of an opaquebg-zinc-900.
dark:* or (--token) classes do not update at runtime
Section titled “dark:* or (--token) classes do not update at runtime”- For dark mode, either resolve styles with
vp.tw(...)wherelet vp = IssViewport::with_theme(width, is_dark);or wrap your root tree intheme_scope(is_dark, content)/dark_scope(content)/light_scope(content). - For theme variables (
bg-(--color-brand)), wrap your view intheme_provider(Arc::clone(&self.theme), content)so descendants read the activeIssThemelive on every render.