Introduction
Panda CSS is a build-time CSS-in-JS engine created by Segun Adebayo (the creator of Chakra UI). It extracts styles at build time into atomic CSS classes, combining the developer experience of writing styles in JavaScript with zero runtime overhead. Panda supports React, Vue, Svelte, and Solid out of the box.
What Panda CSS Does
- Extracts CSS at build time using static analysis of your source files
- Generates atomic utility classes from a configurable design token system
- Provides recipes and slot recipes for component variant patterns
- Supports conditional styles with responsive arrays and color mode selectors
- Produces standard CSS that works with any framework or SSR setup
Architecture Overview
Panda CSS operates as a PostCSS plugin and CLI tool. It scans your source files for css(), cva(), and other style function calls, then statically analyzes the arguments to generate CSS. The output is a set of atomic utility classes written to a styled-system directory. Because extraction happens at build time, no JavaScript is shipped for styling. The design token system maps semantic names to CSS custom properties, enabling theme-aware utilities.
Self-Hosting & Configuration
- Initialize with npx panda init, which creates a panda.config.ts file
- Configure design tokens (colors, spacing, typography) in the config file
- Add the PostCSS plugin or use the CLI watcher for CSS generation
- Import the generated css function from the styled-system output directory
- Deploy with any hosting provider; Panda produces standard CSS files
Key Features
- Zero runtime: all CSS is extracted at build time, no JavaScript injected for styling
- Type-safe utilities with full autocomplete for tokens, properties, and conditions
- Recipes API for defining component variants with compile-time extraction
- Multi-framework support: React, Vue, Svelte, Solid, and Astro
- 5.8k+ GitHub stars from the Chakra UI team with active development
Comparison with Similar Tools
- Tailwind CSS — utility classes in HTML; Panda writes utilities in JS with type safety and token-aware conditions
- vanilla-extract — also zero-runtime but uses .css.ts files; Panda uses collocated style functions with atomic output
- StyleX — Meta's atomic CSS-in-JS; Panda offers a richer design token system and recipe pattern
- Chakra UI — runtime CSS-in-JS; Panda is its spiritual successor with build-time extraction instead
FAQ
Q: Does Panda CSS replace Chakra UI? A: Panda CSS is a separate project by the same author. It focuses on build-time CSS generation while Chakra UI provides runtime styled components.
Q: Can I use Panda CSS with Vue or Svelte? A: Yes. Panda supports any framework through static analysis of source files for style function calls.
Q: How does Panda compare to Tailwind? A: Both generate utility classes, but Panda writes them in JS files with TypeScript autocomplete and token-aware conditions instead of class strings in HTML.
Q: Is there a migration path from Chakra UI? A: Panda provides a similar token and utility API, so migration is conceptually straightforward, but the syntax is different.