lynstack recipe
Variants in, styles out.
npm install @lynstack/class-recipeimport { 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.
- @lynstack/class-recipe1.7.3Class namesFor the web: Tailwind CSS, CSS Modules, or any class names. cva styles one element, sva several, and cx replaces clsx.
- @lynstack/native-recipe1.8.1React Native stylesFor React Native and Expo: typed style objects, built from theme tokens when you need them, that stay the same between renders.
- @lynstack/recipe1.9.1For library authorsFor authors of styling libraries: say how your own type of value combines, and get typed, cached recipes for it.
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.
npx skills add lynstack/recipe --skill class-recipenpx skills add lynstack/recipe --skill native-recipe