pompom
Create type-safe design-system with powerful inline styles
Pompom lets you use conditional styles like :hover, @media, and @container directly in inline styles. Inspired by CSS-Hooks.
The Problem
Inline styles can't express conditions. No :hover, no @media, no :focus. You either write a stylesheet or reach for a CSS-in-JS library or use something like tailwind which generates a stylesheet for you
The CSS Variable Trick
CSS variables have a quirk: initial is invalid and triggers the fallback, while an empty value --foo: ; is valid but does nothing.
We an use this to toggle between two values, Here's an example:
Hover me
--hover-on: ;
--hover-off: initial;
What Pompom Does
Using this technique directly is tedious: you need to manage variable names, write repetitive stylesheet rules, and deal with ugly nested var() syntax. Pompom abstracts all of this away, giving you a type-safe, auto-completing API while generating the minimal CSS needed.
Define Your Design System
Create a config with your conditions (hover, media queries, themes) and custom properties with restricted, typed values.
Render Stylesheet in Root
The stylesheet is a static string containing the CSS variable hooks. It only controls state toggles, not presentational values, so it doesn't grow as you add more components.
Use in Components
The style function returns an object you pass directly to the style prop. TypeScript ensures you only use values defined in your config.