Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions osmium/src/ui/image-link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const logos: { [key: string]: { file: string; style?: string } } = {
less: { file: "less.svg" },
cssmodules: { file: "css-modules.svg", style: "invert" },
macaron: { file: "macaron.svg" },
panda: { file: "panda.svg" },
tailwind: { file: "tailwind.svg" },
stormkit: { file: "stormkit.svg" },
sst: { file: "sst.svg" },
Expand Down
4 changes: 4 additions & 0 deletions public/assets/panda.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
109 changes: 109 additions & 0 deletions src/routes/(2)guides/(0)styling-components/panda-css.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
---
title: Panda CSS
category: Guides / Styling Components
order: 5
mainNavExclude: true
use_cases: >-
styling components, css-in-js, build-time styles, design tokens, type-safe
styles
tags:
- styling
- css
- panda
- css-in-js
- postcss
- tokens
version: "1.0"
description: >-
Set up Panda CSS in your Solid app for build-time CSS-in-JS. Configure
PostCSS, define design tokens, and write type-safe styles.
---

[Panda CSS](https://panda-css.com/) is a build-time CSS-in-JS library that combines the developer experience of CSS-in-JS with the performance of atomic CSS.
Styles are extracted at build time through PostCSS, so no runtime styling code ships to the browser.

## Installation

1. Install Panda CSS as a development dependency:

```package-install-dev
@pandacss/dev
```

2. Initialize Panda CSS in your project.
This creates a `panda.config.ts` file and a `postcss.config.cjs` file:

```package-exec
panda init --postcss
```

3. Add the `prepare` script to your `package.json`, which generates the `styled-system` directory after installs:

```json title="package.json"
{
"scripts": {
"prepare": "panda codegen",
"dev": "vite",
"build": "vite build"
}
}
```

## Configure Panda CSS

Open `panda.config.ts` and make sure the `include` patterns match your source files.
Setting `jsxFramework` to `"solid"` enables Solid-specific JSX style props support:

```ts title="panda.config.ts"
import { defineConfig } from "@pandacss/dev";

export default defineConfig({
preflight: true,
include: ["./src/**/*.{js,jsx,ts,tsx}"],
exclude: [],
jsxFramework: "solid",
outdir: "styled-system",
});
```

## Import the cascade layers

Add the Panda CSS cascade layers to your `src/index.css` file:

```css title="src/index.css"
@layer reset, base, tokens, recipes, utilities;
```

Then import your `index.css` file into the root `index.jsx` or `index.tsx` file:

```jsx
/* @refresh reload */
import { render } from "solid-js/web"
import "./index.css"
import App from "./App"

render(() => <App />, document.getElementById('root') as HTMLElement);
```

## Usage

With Panda CSS set up, use the `css` function from the generated `styled-system` directory to style your components:

```jsx
/* src/App.jsx */
import { css } from "../styled-system/css";

function App() {
return (
<div class={css({ fontSize: "2xl", fontWeight: "bold" })}>
Hello from Panda! 🐼
</div>
);
}

export default App;
```

## Support

For additional assistance, refer to the [Panda CSS installation guide](https://panda-css.com/docs/installation/vite).
2 changes: 1 addition & 1 deletion src/routes/(2)guides/(0)styling-components/tailwind-v3.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Tailwind CSS v3
category: Guides / Styling Components
order: 7
order: 8
mainNavExclude: true
use_cases: >-
utility-first css, rapid prototyping, responsive design, consistent styling,
Expand Down
2 changes: 1 addition & 1 deletion src/routes/(2)guides/(0)styling-components/tailwind.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Tailwind CSS
category: Guides / Styling Components
order: 5
order: 6
mainNavExclude: true
use_cases: >-
styling components, utility classes, rapid ui development, responsive design,
Expand Down
2 changes: 1 addition & 1 deletion src/routes/(2)guides/(0)styling-components/uno.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: UnoCSS
category: Guides / Styling Components
order: 6
order: 7
mainNavExclude: true
use_cases: >-
styling components, utility css, on-demand styles, vite integration, atomic
Expand Down
10 changes: 9 additions & 1 deletion src/routes/(2)guides/(0)styling-your-components.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,21 @@ Many also offer features like theming, media queries, and server-side rendering

**Note:** Before choosing a CSS-in-JS library, it is recommended to check its compatibility with Solid.

### Macaron
<div class="flex flex-col md:grid md:grid-cols-2 md:grid-rows-1 gap-3">

<ImageLink
title="Macaron"
href="/guides/styling-components/macaron"
logo="macaron"
/>
<ImageLink
title="Panda CSS"
href="/guides/styling-components/panda-css"
logo="panda"
/>

</div>

## CSS frameworks

CSS frameworks provide pre-styled components and utility classes to speed up development.
Expand Down
Loading