Introducing a new way to review your PRs.

Read the announcement

chakra-ui / panda

🐼 Universal, Type-Safe, CSS-in-JS Framework for Design Systems ⚡️

View on GitHub

19 documents · Updated Sep 23, 2026

docs / framework-plugin-packages

Framework plugin packages

The framework plugin packages adapt project source and generated CSS to the Panda compilation flow. The Svelte and Vue packages make single-file components readable by Panda. The Astro package connects Panda Studio to an Astro and Vite project. The Lightning CSS package improves the final CSS step for any supported project.

Package roles

Each package joins Panda at a different point in the project lifecycle. The framework packages handle source or development-tool integration, while Lightning CSS handles the CSS output.

PackageMain rolePanda connection
@pandacss/plugin-svelteAdapt .svelte files before source scanningUses Panda's parser-before hook to provide TSX-friendly source
@pandacss/plugin-vueAdapt .vue files before source scanningUses Panda's parser-before hook to provide TSX-friendly source
@pandacss/astro-plugin-studioConnect Panda Studio to Astro and ViteLoads Panda configuration and exposes Studio data through a virtual module
@pandacss/plugin-lightningcssOptimize generated CSSReplaces the default CSS optimization step through Panda's CSS optimization hook

The packages do not replace Panda's compiler. They provide input in a form that Panda can scan, expose Panda data to an Astro tool, or process Panda's CSS after generation.

Framework source adapters

The source adapters run before Panda parses a file. This lets a project keep its native component format while Panda receives a view of the file that matches the parser's expected TSX-like shape.

Svelte source adapter

The @pandacss/plugin-svelte package is a Panda plugin for Svelte single-file components. It detects .svelte files during the parser-before stage, removes Svelte script and style blocks from the template view, and combines the script with a render expression. Panda can then find style declarations in the component without requiring the project to rewrite its Svelte source.

The adapter is part of source discovery, not a Svelte build plug-in. The project's Panda content paths must still include its Svelte files so the compiler can pass them to the adapter.

References: packages/…/index.ts• L1-17 packages/…/svelte-to-tsx.ts• L9-31 packages/…/hooks.ts• L35-39

Vue source adapter

The @pandacss/plugin-vue package is a Panda plugin for Vue single-file components. It detects .vue files before parsing, reads the component template and script content, and presents template bindings in a TSX-like form. This gives Panda a scan-ready view while the project continues to use Vue templates and script blocks.

The adapter covers source scanning only. Vue's own build and runtime remain responsible for compiling and running the component.

References: packages/…/index.ts• L1-17 packages/…/vue-to-tsx.ts• L40-76 packages/…/hooks.ts• L35-39

Astro development integration

The Astro package in this area is @pandacss/astro-plugin-studio. It is an Astro integration for Panda Studio rather than a general .astro source adapter. It adds a Vite plug-in during Astro setup so Studio can read the project's Panda configuration in the same development environment.

Studio data bridge

The integration loads the Panda context from the configured Panda file and publishes a virtual panda module. That module carries the resolved configuration, text styles, layer styles, and themes for the Studio UI. When the Panda configuration changes, the integration reloads the virtual module so Studio can show the new data without a full application restart.

This bridge connects Astro's development server to Panda's configuration and style data. Astro projects still use the normal Panda code generation and CSS pipeline for application styles. The Studio bridge is an additional development tool, as described in Studio tooling.

References: packages/…/index.ts• L1-8 packages/…/index.ts• L10-70 packages/…/index.ts• L72-91 packages/…/package.json• L40-52

CSS output optimization

The Lightning CSS package runs after Panda has produced CSS. It gives projects a native CSS transform that can optimize output for the requested browser targets while keeping Panda's generation step unchanged.

Lightning CSS optimizer

The @pandacss/plugin-lightningcss package registers a replacement for Panda's CSS optimizer. It receives the generated CSS, the minify choice, and the project's browser targets. Lightning CSS then applies the supported nesting and media-range transforms, returns the resulting CSS, and sends transform warnings to Panda's logger.

The package is independent of Svelte, Vue, and Astro. A project can use it with any Panda integration that reaches Panda's CSS optimization stage.

References: packages/…/index.ts• L1-15 packages/…/optimize-lightningcss.ts• L1-35 packages/…/hooks.ts• L64-69 packages/…/hooks.ts• L219-228

Panda compilation flow

The packages connect to Panda at different stages, so the same project can use a source adapter and a CSS optimizer together. The flow below shows how native component source becomes Panda CSS and then passes through optional CSS optimization.

flowchart LR
    A[Project component files] --> B{Framework source adapter}
    B -->|Svelte or Vue| C[TSX-friendly source]
    B -->|Other supported source| C
    C --> D[Panda source parser]
    D --> E[Generated Panda CSS]
    E --> F{CSS optimizer}
    F -->|Lightning CSS enabled| G[Optimized CSS]
    F -->|Default optimizer| H[Final CSS]
    G --> I[Project build]
    H --> I

The source adapter must run before parsing because it changes what Panda can see. Lightning CSS must run after CSS generation because it transforms the CSS result rather than the component source. Astro Studio follows a separate development path that reads Panda context data for the Studio interface.

References: packages/…/hooks.ts• L35-39 packages/…/hooks.ts• L59-69 packages/…/index.ts• L6-16 packages/…/index.ts• L6-16 packages/…/index.ts• L6-13

Change checklist

When these files or sections are changed, remember to consider these:

  • Changes to the Svelte or Vue source shape must keep the output compatible with Panda's parser-before contract. A file that no longer returns scan-ready content can silently remove styles from generated CSS.
  • Changes to supported component extensions must stay aligned between the adapter's file check and each project's Panda include paths.
  • Changes to the Astro virtual module data must stay aligned with the Studio consumers that import it. Config reload behavior must continue to refresh that module.
  • Changes to CSS optimizer inputs must preserve the minify and browser-target contract. A mismatch can produce CSS for the wrong browser set or skip the selected optimization mode.
  • Changes to the CSS optimization hook must keep the fallback behavior clear. Returning no optimized CSS lets Panda use its default optimizer.

Important failure modes

TriggerConsequenceGuard
Svelte or Vue files are not included in Panda content pathsThe adapter is never called and styles from those components are missingKeep the framework file extensions in the Panda include paths
A source adapter cannot transform a componentThe adapter returns empty content and Panda may extract no styles from that fileKeep native component syntax within the adapter's supported shape and check generated CSS when syntax changes
Panda configuration changes without a Studio module reloadAstro Studio shows stale themes or style dataPreserve the config watcher and virtual-module reload path
Lightning CSS receives invalid or unsupported CSSThe CSS transform can warn or fail to produce the expected outputReview Panda CSS warnings and keep the optimizer's error-recovery behavior intact
Browser targets are missing or do not match project supportThe output can use the wrong compatibility transformsPass the project's browser target list to the Lightning CSS plugin

Key files

FileWhy to read it
packages/…/index.tsShows how the Svelte package joins Panda's parser lifecycle
packages/…/svelte-to-tsx.tsShows the source view that Panda scans for Svelte components
packages/…/index.tsShows how the Vue package joins Panda's parser lifecycle
packages/…/vue-to-tsx.tsShows the source view that Panda scans for Vue components
packages/…/index.tsShows the Astro-to-Vite bridge and the Panda data exposed to Studio
packages/…/index.tsShows how Lightning CSS replaces Panda's CSS optimization step
packages/…/optimize-lightningcss.tsShows the browser-target and warning behavior for CSS output
packages/…/hooks.tsDefines the parser and CSS optimization contracts used by these packages