Skip to content

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

Styled System

jsx/

The jsx/ folder — styled factory, JSX patterns, and recipe context helpers.

Folder: styled-system/jsx/
Import: import { styled, Stack } from '../styled-system/jsx'

Generated only when jsxFramework is set (for example 'react'). Without that flag, this folder is absent and style props are not extracted from JSX.

Key files

FileExportRole
jsx/factorystyledstyled.div, styled('button'), factory API
jsx/<pattern>Stack, Grid, …JSX form of each pattern
jsx/create-recipe-contextcreateRecipeContextContext for a single-element recipe
jsx/create-slot-recipe-contextcreateSlotRecipeContextContext for a slot recipe
jsx/indexbarrelRe-exports factory, patterns, helpers

Style props

import { styled } from '../styled-system/jsx'
 
export function Button({ children }: { children: React.ReactNode }) {
  return (
    <styled.button bg="blue.500" color="white" px="4" py="2" rounded="md">
      {children}
    </styled.button>
  )
}

Same atomic CSS as css(); different authoring surface.

JSX patterns

import { Stack, Circle } from '../styled-system/jsx'
 
<Stack gap="4" direction="row">
  <Circle size="12" />
</Stack>

Function form lives under patterns/.

Recipe context

Use createRecipeContext / createSlotRecipeContext to push recipe variants through a compound component tree (headless UI, design-system packages). Guides: Slot recipe context and Recipe context.

See also

Edit this page on GitHubView as markdown
Last updated on