Skip to content
lynstackrecipe

lynstack recipe

Variants in, styles out.

Fast, type-safe recipes that map a component's variants to its class names, its React Native styles, or any value you can combine.
npm install @lynstack/class-recipe
button.ts
import { cva } from "@lynstack/class-recipe";
export const button = cva({
base: "inline-flex items-center rounded-md font-medium",
variants: {
tone: {
neutral: "bg-gray-100 text-gray-900",
danger: "bg-red-600 text-white",
},
size: {
sm: "h-8 px-3 text-sm",
md: "h-10 px-4",
},
},
defaultVariants: { size: "md" },
});
button({ tone: "danger" });
// => "inline-flex items-center rounded-md font-medium bg-red-600 text-white h-10 px-4"

Packages

Which package do you need?

Pick the one for what your components are styled with. Most apps need class-recipe or native-recipe; the engine is for authors of styling libraries.

Why recipe

Fast, type-safe, and the same everywhere

  • Fast

    10× the calls per second of class-variance-authority. A recipe compiles its config once and caches the result of each combination of variants, so a repeated call is a lookup.

  • Type-safe

    Variants, options, and slots are inferred from the config. An unknown option is a type error, and a variant without a default is required.

  • Bring your own merge

    Resolve conflicting classes with twMerge, or with any function of your own. It runs once per combination of variants, not on every call.

  • One engine

    Every package shares the variants, the cache, and the types of one engine, so a recipe behaves the same whatever it returns.

Agent skills

Teach your coding agent the recipes

class-recipe and native-recipe ship agent skills that teach Claude Code, Codex, Cursor, and other agents to write recipes the way these docs recommend.

Terminal window
npx skills add lynstack/recipe --skill class-recipe
npx skills add lynstack/recipe --skill native-recipe