Skip to content

Want to skip the docs? Check out pandamastery.com - the best way to learn Panda CSS

Write styles

Styling

Write styles next to your markup. Panda turns them into atomic CSS at build time.

Panda looks like CSS-in-JS when you write it. You write style objects in TypeScript, and the build emits plain atomic CSS. Nothing in the browser computes those styles.

import { css } from 'styled-system/css'
 
function Button() {
  return (
    <button
      className={css({
        bg: 'blue.500',
        color: 'white',
        px: '4',
        py: '2',
        borderRadius: 'md',
        _hover: { bg: 'blue.600' }
      })}
    >
      Click me
    </button>
  )
}

There is more than one way to author styles in Panda. While the above syntax holds true, css() is only one entry point. Every API below compiles down to the same CSS.

Pick an API

Most styles start as a quick css() call. Reach for patterns when you need layout primitives, style props if you want JSX-prop ergonomics, and recipes once a component actually has variants.

Edit this page on GitHubView as markdown
Last updated on