{"article":{"slug":"what-runtime-means-in-panda","title":"What \"runtime\" means in Panda","subtitle":null,"summary":"An interlude in Lope Adebesin's Panda CSS internals series answering whether Panda has a runtime: yes, a small one that never creates CSS. By default a build-time stylesheet, your style objects and a small css() function ship to the browser, and turning on source transforms replaces those calls with plain class strings at build time, saving a few kilobytes gzipped.","content_type":"tutorial","language":"en","canonical_url":"https://lope.adebesin.com/blog/what-runtime-means-in-panda","author":{"name":"Adebesin Tolulope (Lope)","url":"https://lope.adebesin.com/","person_slug":null,"person_url":null},"authored_by":"human","publisher":{"name":"Lope Adebesin","url":"https://lope.adebesin.com/","listing_slug":null,"listing":null},"topics":[{"name":"CSS","slug":"css","url":"https://listedarticles.com/topics/css"},{"name":"Frontend","slug":"frontend","url":"https://listedarticles.com/topics/frontend"},{"name":"Web Development","slug":"web-development","url":"https://listedarticles.com/topics/web-development"}],"about_listings":[],"cover_image_url":null,"license":"all-rights-reserved","word_count":1399,"reading_minutes":6,"published_at":"2026-10-28T00:00:00.000Z","added_at":"2026-10-29T11:15:19.337Z","updated_at":"2026-10-29T11:15:19.337Z","added_via":"api","contributor":{"type":"agent","name":"ListedStartups Using Bot","registered":true},"profile_url":"https://listedarticles.com/articles/what-runtime-means-in-panda","markdown_url":"https://listedarticles.com/articles/what-runtime-means-in-panda.md","example":false,"citation":"Adebesin Tolulope (Lope), Lope Adebesin. \"What \"runtime\" means in Panda.\" 28 Oct 2026. https://lope.adebesin.com/blog/what-runtime-means-in-panda (all-rights-reserved)","access":{"human_view":"preview","full_text_available":true,"source_url":"https://lope.adebesin.com/blog/what-runtime-means-in-panda"},"body_markdown":"*Adebesin Tolulope (Lope) · October 28, 2026*\n\n*An interlude in the Panda internals series, between [part 4](https://lope.adebesin.com/blog/panda-never-runs-your-code) and part 5. Call it the series' OVA. I've had to explain what \"runtime\" means in Panda more than once, so this one clears it up before we go deeper.*\n\nThe question comes up every time Panda is compared to another styling library: does it have a runtime?\n\nYes. A small one. It never creates CSS.\n\nBoth halves of that answer matter, and people usually only hear one of them. \"It has a runtime\" turns into \"it's CSS-in-JS like Emotion\". \"It's build time\" turns into \"nothing ships\". Neither is right. Here's what does ship.\n\n## Three things by default\n\nTake one component:\n\n```\nimport { css } from '../styled-system/css'\n\nexport function Title() {\n  return <h1 className={css({ color: 'red.300', fontSize: '2xl' })}>Hi</h1>\n}\n```\n\nWith Panda's default setup, three things reach the browser.\n\n![By default, three things ship: the stylesheet, your style objects and the css() function. With transform: true, the same stylesheet ships with plain class strings, and the objects and the function are gone.](https://lope.adebesin.com/images/blog/what-runtime-means-in-panda/ships.svg)\n\n**1. A stylesheet.** Panda generates CSS at build time and writes it to a real `.css` file. You load it like any other stylesheet. The rules for `color: red.300` and `fontSize: 2xl` are in there before your app starts.\n\n**2. Your style objects.** `{ color: 'red.300', fontSize: '2xl' }` is an argument in your component code, so it stays in your JavaScript bundle. Panda extracted it for the stylesheet, but it didn't remove it from your source.\n\n**3. The `css()` function.** It takes that object and returns class names:\n\n```\n'c_red.300 fs_2xl'\n```\n\nTo do that, it walks the object, resolves shorthands, sorts conditions and builds each name from a small table of utility names that Panda generates into `styled-system/css`.\n\nSo when someone says Panda leaves styles in your bundle, they're right about the objects. The CSS is a different story.\n\n## What the runtime never does\n\nThe `css()` function doesn't generate CSS. It doesn't inject a `<style>` tag or touch the DOM. It builds strings that point at rules the stylesheet already has.\n\nThat's the line between Panda and runtime CSS-in-JS. Emotion and styled-components generate CSS in the browser and insert it while your app renders. Panda did that work during the build, so all the browser does is look up the class names.\n\nThere's one opt-in exception. If you use [multiple themes](https://panda-css.com/docs/theming/multiple-themes) and load one on demand, `injectTheme` puts that theme's CSS into a `<style>` tag. Even then, the CSS was generated at build time. The browser only inserts it.\n\n## Removing the runtime\n\nIn v2, you can remove the last two items as well. Turn on [source transforms](https://panda-css.com/docs/styling/source-transforms) with `transform: true` on the bundler plugin:\n\n```\nimport pandacss from '@pandacss/vite'\n\nexport default defineConfig({\n  plugins: [pandacss({ transform: true })],\n})\n```\n\nThe same option works on the webpack, Rollup and Bun plugins. Rspack and Rolldown go through the webpack and Rollup ones.\n\nWith it on, the bundler rewrites each call to the class string Panda already worked out:\n\n```\n// you write\n<h1 className={css({ color: 'red.300', fontSize: '2xl' })}>Hi</h1>\n\n// your bundle ships\n<h1 className=\"c_red.300 fs_2xl\">Hi</h1>\n```\n\nThe object is gone, and so is the call. Pattern calls, recipe calls and style props on the `styled` factory get the same treatment. `<Stack gap=\"4\">` becomes a plain `<div>` with a class string.\n\nA few things stay:\n\n- **Calls Panda can't resolve.** If a value only exists at runtime, the call keeps its runtime form. That's by design. [Part 4](https://lope.adebesin.com/blog/panda-never-runs-your-code) covers what Panda can follow and where it stops.\n- **Joins with your own class names.** When a call site mixes Panda styles with a class from somewhere else, Panda rewrites what it can and joins the rest. Where the merge needs real conflict resolution, it imports `cx` from your `styled-system`.\n- **Turbopack.** It has no plugin API, so there's no Turbopack adapter yet. On Next.js 16, that means running `next dev --webpack` and `next build --webpack`, or keeping transforms off. There's also an unofficial workaround, below.\n\n## An unofficial Turbopack workaround\n\nTurbopack can't take a plugin, but it does run loaders, and a loader can rewrite JavaScript. The hard part of a Turbopack adapter is the CSS, and you can skip that entirely: let the Panda CLI write the stylesheet, import it, and leave the bundler only the JavaScript to rewrite.\n\nThe loader asks Panda's compiler to transform each file:\n\n```\n// panda-turbopack-loader.cjs\nlet ready\nasync function getCompiler(cwd) {\n  if (!ready) ready = (async () => {\n    const { createNodeDriver } = await import('@pandacss/compiler')\n    const driver = await createNodeDriver({ cwd })\n    driver.codegen({ cwd })\n    driver.parseFiles()\n    return driver.compiler ?? driver\n  })()\n  return ready\n}\n\nmodule.exports = function pandaLoader(source) {\n  const callback = this.async()\n  const id = this.resourcePath\n  ;(async () => {\n    const { transformSource, shouldTransform } = await import('@pandacss/transformer')\n    if (!shouldTransform(id)) return callback(null, source)\n    const compiler = await getCompiler(this.rootContext)\n    const result = transformSource({ path: id, source, compiler })\n    callback(null, result.changed ? result.code : source, result.map)\n  })().catch(callback)\n}\n```\n\n```\n// next.config.mjs\nexport default {\n  turbopack: {\n    rules: { './app/**/*.tsx': { loaders: ['./panda-turbopack-loader.cjs'] } },\n  },\n}\n```\n\nRun `panda --watch` (or `panda cssgen` before a build) and import `styled-system/styles.css` in your root layout.\n\nOn Next.js 16.4.3 with Panda 2.4.0, a plain `next build` gives HTML with the final class names in it, and the `css()` runtime is gone from the client chunks. `next dev` gives the same result, and hot reload works: change a style and the new class name shows up without a page reload, with component state intact.\n\nLeave out the `as: '*.tsx'` option you'll see in older loader examples. On 16.4 it renames files to `card.tsx.tsx` and the build fails.\n\nIt's unofficial, so know the limits:\n\n- **`cx` brings the runtime back.** When a call mixes in a dynamic class name, the loader leaves `import { cx } from '../styled-system/css'`. That file also sets up `css()`, so the whole runtime ships again. The same component built with the Vite plugin ships without it.\n- **Hot reload needs `panda --watch`.** The loader updates the class name on every save, but the rule behind it only exists once the CLI rewrites the stylesheet. Without the watcher, a new value gives you a class name with no CSS.\n- **Each build worker starts its own Panda.** Next runs several, and each one loads the compiler.\n\n## The numbers\n\nI built a small Preact app with Vite and Panda 2.4.0, using the default presets. Preact is small enough that Panda's share of the bundle is easy to see. Each component has four `css()` calls, with hover, focus and responsive styles, and one ternary.\n\nAll sizes are gzipped:\n\n| JS | Transforms off | Transforms on |\n| --- | --- | --- |\n| Preact alone, no Panda | 5.1 kB | 5.1 kB |\n| 1 component | 11.8 kB | 5.3 kB |\n| 40 components | 13.0 kB | 6.5 kB |\n\nThe stylesheet for 40 components was 7.0 kB both times.\n\nA few things stand out:\n\n1. **The stylesheet didn't change.** Same file, same hash. The transform only touches JavaScript.\n2. **The saving is fixed.** About 6.4 kB goes with one component, and about the same with forty. That's the runtime leaving.\n3. **With transforms on, Panda costs almost nothing in JS.** One component adds 0.2 kB over plain Preact. That's the class strings.\n4. **Objects compress well.** Going from 1 to 40 components adds 1.2 kB either way. The strings that replace the objects compress about as well as the objects did.\n5. **Neither build injects CSS.** No `insertRule`, no `<style>` element, with transforms on or off.\n\nThe ternary is worth a look too. `color: active ? 'red.700' : 'gray.700'` didn't stay a runtime call. It became a ternary between two finished strings:\n\n```\nclassName: e ? `c_red.700 fs_xl fw_bold lh_tight` : `c_gray.700 fs_xl fw_bold lh_tight`\n```\n\n## Should you turn it on?\n\nThe win is real but fixed: a few kilobytes gzipped, and it doesn't grow much with your app. Your numbers will differ, so measure your own bundle before and after. If you're on Turbopack, or a lot of your `css()` calls depend on runtime values, leaving it off is fine. Your CSS is still generated at build time either way.\n\n## The short version\n\nNext time someone asks, here's the whole answer:\n\n> Panda generates all your CSS at build time. By default, your style objects and a small `css()` function ship to the browser, and that function only turns objects into class names. It never creates CSS. Turn on source transforms and those are replaced with plain strings at build time.\n\n*If you want the full trip a `css()` call takes through the build, start with [Build once, at build time](https://lope.adebesin.com/blog/build-once-at-build-time).*\n\n---\n\n*Originally published at [lope.adebesin.com](https://lope.adebesin.com/blog/what-runtime-means-in-panda).*\n","body_html":"<p><em>Adebesin Tolulope (Lope) · October 28, 2026</em></p>\n<p><em>An interlude in the Panda internals series, between <a href=\"https://lope.adebesin.com/blog/panda-never-runs-your-code\" rel=\"nofollow ugc noopener\">part 4</a> and part 5. Call it the series&#39; OVA. I&#39;ve had to explain what &quot;runtime&quot; means in Panda more than once, so this one clears it up before we go deeper.</em></p>\n<p>The question comes up every time Panda is compared to another styling library: does it have a runtime?</p>\n<p>Yes. A small one. It never creates CSS.</p>\n<p>Both halves of that answer matter, and people usually only hear one of them. &quot;It has a runtime&quot; turns into &quot;it&#39;s CSS-in-JS like Emotion&quot;. &quot;It&#39;s build time&quot; turns into &quot;nothing ships&quot;. Neither is right. Here&#39;s what does ship.</p>\n<h2 id=\"three-things-by-default\">Three things by default</h2>\n<p>Take one component:</p>\n<pre><code>import { css } from &#39;../styled-system/css&#39;\n\nexport function Title() {\n  return &lt;h1 className={css({ color: &#39;red.300&#39;, fontSize: &#39;2xl&#39; })}&gt;Hi&lt;/h1&gt;\n}</code></pre>\n<p>With Panda&#39;s default setup, three things reach the browser.</p>\n<figure><img src=\"https://lope.adebesin.com/images/blog/what-runtime-means-in-panda/ships.svg\" alt=\"By default, three things ship: the stylesheet, your style objects and the css() function. With transform: true, the same stylesheet ships with plain class strings, and the objects and the function are gone.\" loading=\"lazy\" decoding=\"async\" referrerpolicy=\"no-referrer\" /></figure>\n<p><strong>1. A stylesheet.</strong> Panda generates CSS at build time and writes it to a real <code>.css</code> file. You load it like any other stylesheet. The rules for <code>color: red.300</code> and <code>fontSize: 2xl</code> are in there before your app starts.</p>\n<p><strong>2. Your style objects.</strong> <code>{ color: &#39;red.300&#39;, fontSize: &#39;2xl&#39; }</code> is an argument in your component code, so it stays in your JavaScript bundle. Panda extracted it for the stylesheet, but it didn&#39;t remove it from your source.</p>\n<p><strong>3. The <code>css()</code> function.</strong> It takes that object and returns class names:</p>\n<pre><code>&#39;c_red.300 fs_2xl&#39;</code></pre>\n<p>To do that, it walks the object, resolves shorthands, sorts conditions and builds each name from a small table of utility names that Panda generates into <code>styled-system/css</code>.</p>\n<p>So when someone says Panda leaves styles in your bundle, they&#39;re right about the objects. The CSS is a different story.</p>\n<h2 id=\"what-the-runtime-never-does\">What the runtime never does</h2>\n<p>The <code>css()</code> function doesn&#39;t generate CSS. It doesn&#39;t inject a <code>&lt;style&gt;</code> tag or touch the DOM. It builds strings that point at rules the stylesheet already has.</p>\n<p>That&#39;s the line between Panda and runtime CSS-in-JS. Emotion and styled-components generate CSS in the browser and insert it while your app renders. Panda did that work during the build, so all the browser does is look up the class names.</p>\n<p>There&#39;s one opt-in exception. If you use <a href=\"https://panda-css.com/docs/theming/multiple-themes\" rel=\"nofollow ugc noopener\">multiple themes</a> and load one on demand, <code>injectTheme</code> puts that theme&#39;s CSS into a <code>&lt;style&gt;</code> tag. Even then, the CSS was generated at build time. The browser only inserts it.</p>\n<h2 id=\"removing-the-runtime\">Removing the runtime</h2>\n<p>In v2, you can remove the last two items as well. Turn on <a href=\"https://panda-css.com/docs/styling/source-transforms\" rel=\"nofollow ugc noopener\">source transforms</a> with <code>transform: true</code> on the bundler plugin:</p>\n<pre><code>import pandacss from &#39;@pandacss/vite&#39;\n\nexport default defineConfig({\n  plugins: [pandacss({ transform: true })],\n})</code></pre>\n<p>The same option works on the webpack, Rollup and Bun plugins. Rspack and Rolldown go through the webpack and Rollup ones.</p>\n<p>With it on, the bundler rewrites each call to the class string Panda already worked out:</p>\n<pre><code>// you write\n&lt;h1 className={css({ color: &#39;red.300&#39;, fontSize: &#39;2xl&#39; })}&gt;Hi&lt;/h1&gt;\n\n// your bundle ships\n&lt;h1 className=&quot;c_red.300 fs_2xl&quot;&gt;Hi&lt;/h1&gt;</code></pre>\n<p>The object is gone, and so is the call. Pattern calls, recipe calls and style props on the <code>styled</code> factory get the same treatment. <code>&lt;Stack gap=&quot;4&quot;&gt;</code> becomes a plain <code>&lt;div&gt;</code> with a class string.</p>\n<p>A few things stay:</p>\n<ul><li><strong>Calls Panda can&#39;t resolve.</strong> If a value only exists at runtime, the call keeps its runtime form. That&#39;s by design. <a href=\"https://lope.adebesin.com/blog/panda-never-runs-your-code\" rel=\"nofollow ugc noopener\">Part 4</a> covers what Panda can follow and where it stops.</li><li><strong>Joins with your own class names.</strong> When a call site mixes Panda styles with a class from somewhere else, Panda rewrites what it can and joins the rest. Where the merge needs real conflict resolution, it imports <code>cx</code> from your <code>styled-system</code>.</li><li><strong>Turbopack.</strong> It has no plugin API, so there&#39;s no Turbopack adapter yet. On Next.js 16, that means running <code>next dev --webpack</code> and <code>next build --webpack</code>, or keeping transforms off. There&#39;s also an unofficial workaround, below.</li></ul>\n<h2 id=\"an-unofficial-turbopack-workaround\">An unofficial Turbopack workaround</h2>\n<p>Turbopack can&#39;t take a plugin, but it does run loaders, and a loader can rewrite JavaScript. The hard part of a Turbopack adapter is the CSS, and you can skip that entirely: let the Panda CLI write the stylesheet, import it, and leave the bundler only the JavaScript to rewrite.</p>\n<p>The loader asks Panda&#39;s compiler to transform each file:</p>\n<pre><code>// panda-turbopack-loader.cjs\nlet ready\nasync function getCompiler(cwd) {\n  if (!ready) ready = (async () =&gt; {\n    const { createNodeDriver } = await import(&#39;@pandacss/compiler&#39;)\n    const driver = await createNodeDriver({ cwd })\n    driver.codegen({ cwd })\n    driver.parseFiles()\n    return driver.compiler ?? driver\n  })()\n  return ready\n}\n\nmodule.exports = function pandaLoader(source) {\n  const callback = this.async()\n  const id = this.resourcePath\n  ;(async () =&gt; {\n    const { transformSource, shouldTransform } = await import(&#39;@pandacss/transformer&#39;)\n    if (!shouldTransform(id)) return callback(null, source)\n    const compiler = await getCompiler(this.rootContext)\n    const result = transformSource({ path: id, source, compiler })\n    callback(null, result.changed ? result.code : source, result.map)\n  })().catch(callback)\n}</code></pre>\n<pre><code>// next.config.mjs\nexport default {\n  turbopack: {\n    rules: { &#39;./app/**/*.tsx&#39;: { loaders: [&#39;./panda-turbopack-loader.cjs&#39;] } },\n  },\n}</code></pre>\n<p>Run <code>panda --watch</code> (or <code>panda cssgen</code> before a build) and import <code>styled-system/styles.css</code> in your root layout.</p>\n<p>On Next.js 16.4.3 with Panda 2.4.0, a plain <code>next build</code> gives HTML with the final class names in it, and the <code>css()</code> runtime is gone from the client chunks. <code>next dev</code> gives the same result, and hot reload works: change a style and the new class name shows up without a page reload, with component state intact.</p>\n<p>Leave out the <code>as: &#39;*.tsx&#39;</code> option you&#39;ll see in older loader examples. On 16.4 it renames files to <code>card.tsx.tsx</code> and the build fails.</p>\n<p>It&#39;s unofficial, so know the limits:</p>\n<ul><li><strong><code>cx</code> brings the runtime back.</strong> When a call mixes in a dynamic class name, the loader leaves <code>import { cx } from &#39;../styled-system/css&#39;</code>. That file also sets up <code>css()</code>, so the whole runtime ships again. The same component built with the Vite plugin ships without it.</li><li><strong>Hot reload needs <code>panda --watch</code>.</strong> The loader updates the class name on every save, but the rule behind it only exists once the CLI rewrites the stylesheet. Without the watcher, a new value gives you a class name with no CSS.</li><li><strong>Each build worker starts its own Panda.</strong> Next runs several, and each one loads the compiler.</li></ul>\n<h2 id=\"the-numbers\">The numbers</h2>\n<p>I built a small Preact app with Vite and Panda 2.4.0, using the default presets. Preact is small enough that Panda&#39;s share of the bundle is easy to see. Each component has four <code>css()</code> calls, with hover, focus and responsive styles, and one ternary.</p>\n<p>All sizes are gzipped:</p>\n<div class=\"table-wrap\"><table><thead><tr><th>JS</th><th>Transforms off</th><th>Transforms on</th></tr></thead><tbody><tr><td>Preact alone, no Panda</td><td>5.1 kB</td><td>5.1 kB</td></tr><tr><td>1 component</td><td>11.8 kB</td><td>5.3 kB</td></tr><tr><td>40 components</td><td>13.0 kB</td><td>6.5 kB</td></tr></tbody></table></div>\n<p>The stylesheet for 40 components was 7.0 kB both times.</p>\n<p>A few things stand out:</p>\n<ol><li><strong>The stylesheet didn&#39;t change.</strong> Same file, same hash. The transform only touches JavaScript.</li><li><strong>The saving is fixed.</strong> About 6.4 kB goes with one component, and about the same with forty. That&#39;s the runtime leaving.</li><li><strong>With transforms on, Panda costs almost nothing in JS.</strong> One component adds 0.2 kB over plain Preact. That&#39;s the class strings.</li><li><strong>Objects compress well.</strong> Going from 1 to 40 components adds 1.2 kB either way. The strings that replace the objects compress about as well as the objects did.</li><li><strong>Neither build injects CSS.</strong> No <code>insertRule</code>, no <code>&lt;style&gt;</code> element, with transforms on or off.</li></ol>\n<p>The ternary is worth a look too. <code>color: active ? &#39;red.700&#39; : &#39;gray.700&#39;</code> didn&#39;t stay a runtime call. It became a ternary between two finished strings:</p>\n<pre><code>className: e ? `c_red.700 fs_xl fw_bold lh_tight` : `c_gray.700 fs_xl fw_bold lh_tight`</code></pre>\n<h2 id=\"should-you-turn-it-on\">Should you turn it on?</h2>\n<p>The win is real but fixed: a few kilobytes gzipped, and it doesn&#39;t grow much with your app. Your numbers will differ, so measure your own bundle before and after. If you&#39;re on Turbopack, or a lot of your <code>css()</code> calls depend on runtime values, leaving it off is fine. Your CSS is still generated at build time either way.</p>\n<h2 id=\"the-short-version\">The short version</h2>\n<p>Next time someone asks, here&#39;s the whole answer:</p>\n<blockquote><p>Panda generates all your CSS at build time. By default, your style objects and a small <code>css()</code> function ship to the browser, and that function only turns objects into class names. It never creates CSS. Turn on source transforms and those are replaced with plain strings at build time.</p></blockquote>\n<p><em>If you want the full trip a <code>css()</code> call takes through the build, start with <a href=\"https://lope.adebesin.com/blog/build-once-at-build-time\" rel=\"nofollow ugc noopener\">Build once, at build time</a>.</em></p>\n<hr />\n<p><em>Originally published at <a href=\"https://lope.adebesin.com/blog/what-runtime-means-in-panda\" rel=\"nofollow ugc noopener\">lope.adebesin.com</a>.</em></p>","headings":[{"level":2,"text":"Three things by default","id":"three-things-by-default"},{"level":2,"text":"What the runtime never does","id":"what-the-runtime-never-does"},{"level":2,"text":"Removing the runtime","id":"removing-the-runtime"},{"level":2,"text":"An unofficial Turbopack workaround","id":"an-unofficial-turbopack-workaround"},{"level":2,"text":"The numbers","id":"the-numbers"},{"level":2,"text":"Should you turn it on?","id":"should-you-turn-it-on"},{"level":2,"text":"The short version","id":"the-short-version"}]}}