--- author: [Teemu Lahjalahti](https://www.linkedin.com/in/teemulahjalahti/) index: https://salty-css.dev/llms.txt --- # Introduction to Styled Components `styled` is where you'll spend most of your time in Salty CSS. You hand it a tag and a style object, and you get back a typed component whose variants are props. If `export const Card = styled("div"` already lives in your muscle memory from Stitches or Panda, the shape won't surprise you — same API in spirit, with a handful of nuances of its own. ## What the API is shaped around Four ideas explain most of why `styled` looks the way it does. None of them are required reading — the code below works either way — but they're the difference between using the API and using it well. [Design philosophy](/concepts/design-philosophy) is the long version of all four. **What shaped it.** Stitches was the original spark: a typed, variant-driven `styled` API that was simply a joy to use. When it was discontinued, the ground had already shifted underneath it — React Server Components and server-first frameworks put real pressure on runtime CSS-in-JS, where theming leans on Context and styles get injected during render. In a tree where much of your markup never touches a client runtime, that's a liability. So Salty keeps the component-first `styled` API but *executes* your style files at build time rather than statically analyzing them, and leans on native browser features for theming and overrides. What reaches the browser is a stylesheet. **Build components, not class names.** The `styled` + TypeScript combination lets you build design-system atoms *directly* — not a class you then wrap in a component by hand, but the component itself. These are presentational: dumb, stateless, knowing only how they look and what states they can be in, and nothing about where their data comes from. The contract is the point. Import a `styled` component and your editor already knows its tag, its variants and its props; a class name is a string with no contract and no autocomplete. Salty does export [`className()`](/next/docs/basics/class-names) for the cases where a string is what you need — third-party DOM, a framework without a `styled` — and it's a fair escape hatch rather than a lesser one. It's just not the default. **Variants as layers.** Variants usually get explained as a way to branch CSS on a prop. The more useful way to hold them is as layers: `base` is the part that's fixed and true no matter what, variants are the named axes of variation stacked on top — `size`, `intent`, `tone` — and the states your component can actually be in are the combinations of those axes. You think in axes, not in one-off branches. This has a practical consequence you'll meet in Example 2: extending a component is the same move as writing a rule in a higher cascade layer, so the outer component wins without a specificity fight. **Primitives over pre-baked UI kits.** Salty is not a UI kit and won't hand you a styled `