DEV Community

Alex Spinov
Alex Spinov

Posted on

Panda CSS Has a Free API You Should Know About

Panda CSS is a zero-runtime CSS-in-JS library with build-time extraction. Write type-safe styles in TypeScript that compile to atomic CSS — no runtime overhead.

Why Panda CSS Wins

A team using Emotion was spending 15ms per render on CSS-in-JS overhead. They switched to Panda CSS — same developer experience, but styles compile at build time. Runtime CSS cost: zero.

Key Features:

  • Zero Runtime — Styles extracted at build time
  • Type-Safe — Full TypeScript autocomplete for properties and values
  • Design Tokens — Built-in token system for consistent design
  • Recipes — Multi-variant component styles
  • Atomic CSS — Optimal output, no duplicate styles

Quick Start

npm install -D @pandacss/dev
npx panda init
Enter fullscreen mode Exit fullscreen mode
import { css } from "../styled-system/css"

function Button() {
  return (
    <button className={css({
      bg: "blue.500",
      color: "white",
      px: "4",
      py: "2",
      rounded: "md",
      _hover: { bg: "blue.600" }
    })}>
      Click me
    </button>
  )
}
Enter fullscreen mode Exit fullscreen mode

Recipes (Component Variants)

import { cva } from "../styled-system/css"

const button = cva({
  base: { px: "4", py: "2", rounded: "md", cursor: "pointer" },
  variants: {
    visual: {
      solid: { bg: "blue.500", color: "white" },
      outline: { border: "1px solid", borderColor: "blue.500" }
    },
    size: {
      sm: { fontSize: "sm" },
      lg: { fontSize: "lg", px: "6", py: "3" }
    }
  }
})
Enter fullscreen mode Exit fullscreen mode

Why Choose Panda CSS

  1. Zero runtime — no performance cost
  2. Type safety — autocomplete everything
  3. Design tokens — built-in system for consistency

Check out Panda CSS docs to get started.


Building styled apps? Check out my Apify actors or email spinov001@gmail.com for custom solutions.

Top comments (0)