Framework integrations
Panda integrates with framework build systems by keeping styling at build time and adapting only the parts that differ between component ecosystems. Framework plugins make component source readable to the compiler, while build plugins connect CSS output and Studio data to the host toolchain.
Integration model
Panda works through the build system that already runs a project. PostCSS is the main path for framework projects, and the CLI remains available when a framework does not provide that path. This keeps the generated result as normal CSS and generated styling APIs rather than tying runtime styling to one framework.
The framework guides provide the user-facing setup for supported application types. The integration layer has two jobs:
- adapt component source so the compiler can find Panda usage;
- adapt CSS or development data to the host build tool.
This separation lets the compiler keep one styling model while each framework supplies its own source format and development server.
Component source adaptation
Parser input normalization
The parser accepts a parser:before hook that can replace source content before Panda extracts style usage. The Vue and Svelte plugins use this boundary to turn single-file component content into a TSX-friendly form, so template expressions and script code can reach the same extraction path as JavaScript and TypeScript source. See Framework plugin packages for the package-level roles.
The framework plugin is not a second styling engine. It changes the view of a component for extraction, then returns control to the shared parser. The compiler can therefore produce the same design-system CSS and generated APIs for component files and ordinary source files.
References: packages/…/hooks.ts• L35-40 packages/…/project.ts• L137-178 packages/…/index.ts• L6-16 packages/…/index.ts• L6-16
CSS pipeline adaptation
CSS optimizer selection
Panda exposes a CSS optimization hook for build systems that need a different CSS tool. When the lightningcss option is enabled, Panda adds the Lightning CSS plugin and uses the project browser target settings to optimize the generated stylesheet. Without a replacement result, the normal PostCSS optimizer remains the fallback.
This gives a project a choice of CSS pipeline without changing the compiler stages that create design-system styles. The browser target is part of the contract because it controls which CSS features the optimizer can emit.
References: packages/…/config.ts• L358-371 packages/…/hooks.ts• L65-69 packages/…/optimize.ts• L13-29 packages/…/index.ts• L6-14 packages/…/optimize-lightningcss.ts• L12-34
Plugin lifecycle
Hook composition
Panda collects built-in and project plugins into one hook chain. Hooks that transform source or CSS pass their result to the next hook, so framework adapters can participate without owning the full compiler lifecycle. The Node integration adds the Vue and Svelte adapters by default and adds the Lightning CSS adapter when its configuration option is enabled.
The lifecycle is ordered around shared compiler boundaries:
- The build system supplies source files or generated CSS.
- A framework hook adapts the input when its file type or option matches.
- Panda parses source or optimizes CSS through the shared compiler path.
- The build system receives generated CSS and codegen output.
flowchart LR
A[Framework source] --> B{Framework adapter}
B --> C[Panda parser]
C --> D[Generated styling artifacts]
D --> E{CSS optimizer}
E --> F[Host build system]
B -. no match .-> C
E -. default .-> F
References: packages/…/auto-plugins.ts• L10-28 packages/…/merge-hooks.ts• L6-35 packages/…/merge-hooks.ts• L58-71 packages/…/merge-hooks.ts• L129-142
Studio development experience
Astro and Vite bridge
Studio uses an Astro integration to join Panda project data to the Astro and Vite development loop. The bridge loads the Panda configuration and exposes a virtual module with configuration, text styles, layer styles, and themes for the Studio interface. When the configuration changes, the development server reloads that virtual module so the view stays aligned with the project.
Studio is therefore a development surface over the same Panda configuration rather than a separate design-token source. See Studio tooling for the Studio package and its interactive workflows.
References: packages/…/index.ts• L1-8 packages/…/index.ts• L10-35 packages/…/index.ts• L37-69 packages/…/index.ts• L72-89 packages/…/package.json• L56-69
Framework coverage
Framework setup paths
Panda presents framework setup as a set of guides because the host tools differ even when the styling result is the same. The getting-started flow points users to framework-specific guides, while the framework card list covers common application and component environments such as Next.js, Vite, Svelte, Astro, Vue, Remix, Qwik, and Storybook.
Not every listed environment needs a dedicated Panda plugin. Frameworks that expose a compatible PostCSS or JavaScript build path can use the shared integration model directly. Dedicated plugins are reserved for source formats or CSS stages that need an adapter.
References: website/…/getting-started.mdx• L15-29 website/…/framework-card.tsx• L20-95 website/…/svelte.mdx• L1-7 website/…/vue.mdx• L1-7
Change checklist
When these files or sections are changed, remember to consider these:
- A new component file format needs a parser hook and a path through the shared extraction rules. Check both hook composition and the file matching rule.
- A new CSS optimizer option needs matching configuration types, automatic plugin activation, and fallback behavior in the core optimizer.
- A change to the Studio data contract must update both the virtual module exports and the Studio consumers that read them.
- A change to config reload behavior must preserve the link between the watched config file and the virtual module reload.
- A framework guide or framework card should link to the same setup path that the build integration supports.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A Vue or Svelte file is not passed through its matching parser adapter | Panda may not see style usage inside the component source | Keep the adapter active in the resolved hook set and keep its file suffix match aligned with the framework format |
| A source adapter returns invalid or empty transformed content | Extraction loses the component's style usage | Treat adapter output as parser input and preserve the original source contract when adding transformations |
| Lightning CSS is enabled without the intended browser target | The generated CSS can target the wrong browser range | Set browserslist deliberately or use the project's discovered browser defaults |
PUBLIC_CONFIG_PATH is missing or points to the wrong file | Studio cannot load the project configuration for its virtual module | Point the Astro integration at the same Panda config used by the project build |
| Studio config data changes without a virtual-module reload | The development view can show stale tokens, styles, or themes | Keep config watching and module invalidation together |
Key files
| File | Why to read it |
|---|---|
| packages/…/hooks.ts | Defines the shared extension points for source parsing and CSS optimization. |
| packages/…/auto-plugins.ts | Shows which adapters Panda adds automatically and which option enables each one. |
| packages/…/merge-hooks.ts | Explains how plugin results move through the shared hook chain. |
| packages/…/project.ts | Shows where adapted source enters the parser lifecycle. |
| packages/…/index.ts | Entry point for Vue single-file component support. |
| packages/…/index.ts | Entry point for Svelte single-file component support. |
| packages/…/index.ts | Entry point for replacing the default CSS optimizer. |
| packages/…/index.ts | Connects Panda configuration and style data to Astro and Vite development. |
| packages/…/package.json | Shows Studio's role as an Astro-based developer experience and its bridge dependency. |
| website/…/getting-started.mdx | Describes the user-facing choice between CLI, PostCSS, and framework guides. |