I spent years trying to make CSS states predictable

· coding design books · Source ↗

TLDR

  • Tasty compiles declarative state maps into mutually exclusive CSS selectors, eliminating cascade and source-order ambiguity in component design systems.

Key Takeaways

  • CSS specificity ties fall back to source order, so hover-vs-disabled conflicts silently break components depending on rule order, not intent.
  • Tasty’s state map API lets authors declare priority once; the compiler generates :not() chains that guarantee no two branches match simultaneously.
  • The generated selectors handle pseudo-classes, attributes, media queries, container queries, and root-level state without requiring authors to reason about their intersections.
  • Tasty powers Cube UI Kit (100+ components, Cube Cloud enterprise product), so the model has been validated under real production and team-scale pressure.
  • The approach trades simplicity for durability: adds compiler overhead, but extension and multi-author maintenance become safer as variant and theme count grows.

Hacker News Comment Review

  • No substantive HN discussion yet.

Original | Discuss on HN