Tailwind CSS is the most common Astro CSS framework, but it is far from the only one that works well. UnoCSS gives you utility classes with an official Astro integration, Open Props gives you design tokens as CSS variables, Pico CSS styles semantic HTML with no classes at all, and Bootstrap, Bulma and Panda CSS all install with a single import or plugin. Because Astro processes CSS through Vite, nearly any framework that ships a stylesheet or a Vite or PostCSS plugin works.
This guide compares the realistic options, shows the setup for each in an Astro 7 project, and ends with a clear way to choose.
Key Takeaways
- Any framework that ships CSS works in Astro; import it in your base layout.
- UnoCSS is the closest Tailwind alternative and has an official Astro integration.
- Open Props and Pico CSS pair well with Astro’s scoped styles because they add little or no class markup.
- Component frameworks like Bootstrap ship JavaScript for interactive parts; load only what you use.
- Astro’s own scoped
<style>blocks are a complete styling system for many sites.
How CSS frameworks plug into Astro
Astro hands CSS to Vite, so the integration story is the same for almost every framework. There are three patterns:
- Stylesheet import. Import the framework’s CSS file in your base layout’s frontmatter. Vite bundles it with your other CSS. Bootstrap, Bulma, Pico CSS and Open Props work this way.
- Vite or PostCSS plugin. The framework generates CSS from your source at build time. UnoCSS and Panda CSS work this way, as does Tailwind.
- Preprocessor. Sass, Less and Stylus work once the preprocessor package is installed, with no Astro config. The Sass setup tip covers it.
Whatever you choose, Astro’s scoped <style> blocks still work alongside it. That matters, because it lets you use a framework for the base and write component-specific CSS where the framework falls short. The scoped vs global styles guide explains how the two layers interact.
Comparison at a glance
| Framework | Type | Setup in Astro | Ships JS | Best for |
|---|---|---|---|---|
| UnoCSS | On-demand utilities | Official integration | No | Tailwind-style workflow, custom rules |
| Open Props | CSS variable tokens | One CSS import | No | Hand-written CSS with good defaults |
| Pico CSS | Classless or minimal classes | One CSS import | No | Docs, prototypes, small sites |
| Bootstrap | Component framework | CSS import, optional JS | Optional | Teams that already know it |
| Bulma | Component framework | CSS import | No | Bootstrap-style layouts without JS |
| Panda CSS | Build-time CSS-in-JS | PostCSS plugin | No | Typed style functions and design tokens |
| Scoped CSS | Astro built-in | Nothing to install | No | Most sites, especially themes |
UnoCSS: utility-first without Tailwind
UnoCSS is an on-demand atomic CSS engine. It generates only the utilities you use, like Tailwind, and its default preset is largely compatible with Tailwind class names. Its strengths are flexibility (write your own rules and shortcuts in a few lines) and extra presets such as pure-CSS icons.
npm install -D unocss
// astro.config.mjs
import { defineConfig } from 'astro/config';
import UnoCSS from 'unocss/astro';
export default defineConfig({
integrations: [UnoCSS({ injectReset: true })],
});
// uno.config.ts
import { defineConfig, presetWind3 } from 'unocss';
export default defineConfig({
presets: [presetWind3()],
shortcuts: {
btn: 'inline-flex items-center gap-2 rounded-lg bg-blue-600 px-4 py-2 font-semibold text-white hover:bg-blue-700',
},
});
Now class="btn" and any Tailwind-style utility work in your components. Check the UnoCSS docs for the preset names in your version, since presets have been renamed as UnoCSS tracks Tailwind releases. Choose UnoCSS if you like utilities but want to define your own rules; choose Tailwind if you want the larger ecosystem of plugins, examples and tooling. The Tailwind CSS in Astro guide covers that path.
Open Props: tokens, not classes
Open Props is a set of CSS custom properties: colors, sizes, shadows, easings, gradients and more. It does not style anything by itself. You write normal CSS and reach for its variables, which fits Astro’s scoped styles perfectly.
npm install open-props
---
// src/layouts/BaseLayout.astro
import 'open-props/style';
import 'open-props/normalize';
---
<html lang="en">
<body><slot /></body>
</html>
---
// src/components/Card.astro
---
<article class="card"><slot /></article>
<style>
.card {
padding: var(--size-5);
border-radius: var(--radius-3);
box-shadow: var(--shadow-3);
background: var(--surface-2, white);
}
</style>
The normalize import adds sensible base styles with light and dark support. If you would rather keep tokens in your own file, the design tokens with CSS variables guide shows the same approach without a dependency.
Pico CSS: style the HTML you already write
Pico CSS styles semantic elements directly. A <nav>, a <form> with labels, a <table> and an <article> all look finished with no classes. That makes it a good match for Astro content sites, where much of the HTML comes from Markdown you do not want to annotate.
npm install @picocss/pico
---
// src/layouts/BaseLayout.astro
import '@picocss/pico/css/pico.min.css';
---
<html lang="en">
<body>
<main class="container"><slot /></main>
</body>
</html>
Pico respects prefers-color-scheme and supports a data-theme attribute on <html> for a manual toggle. It ships classless and minimal-class builds and color variants; see its docs for the file names. It is a strong pick for documentation, internal tools and prototypes. For a branded marketing site, you will override much of it.
Bootstrap and Bulma: component frameworks
Bootstrap’s grid, utilities and components work in Astro with a CSS import. Its interactive components (dropdowns, modals, collapse) need Bootstrap’s JavaScript, which you can load as a normal Astro script so it is bundled and only sent where used:
npm install bootstrap
---
// src/layouts/BaseLayout.astro
import 'bootstrap/dist/css/bootstrap.min.css';
---
<html lang="en">
<body>
<slot />
<script>
import 'bootstrap/js/dist/collapse';
</script>
</body>
</html>
Import only the JavaScript components you use, as above, rather than the whole bundle. To customize Bootstrap’s variables, install Sass and import its SCSS source instead of the compiled CSS.
Bulma offers a similar component and layout system in pure CSS, with no JavaScript at all; a mobile menu toggle is a few lines you write yourself. Both frameworks add a lot of CSS compared with utility engines, because you get every component’s styles whether you use them or not. If you only need a few components, Astro components with scoped styles are usually lighter. For the JavaScript side of a mobile menu, the mobile nav component shows a dependency-free version.
Panda CSS: typed styles generated at build time
Panda CSS lets you write styles as typed function calls in your frontmatter and generates static atomic CSS at build time. There is no runtime. It suits teams who want design tokens and variants with TypeScript autocompletion.
npm install -D @pandacss/dev
npx panda init --postcss
Then add the generated layers to a global stylesheet and use the css() function in components:
/* src/styles/global.css */
@layer reset, base, tokens, recipes, utilities;
---
// src/components/Alert.astro
import { css } from '../../styled-system/css';
---
<div class={css({ p: '4', rounded: 'md', bg: 'yellow.100', color: 'yellow.900' })}>
<slot />
</div>
Make sure the include paths in panda.config.ts cover ./src/**/*.{astro,ts,tsx} so Panda finds your styles. The setup is heavier than the other options here, so it pays off on larger codebases with a real design system.
Astro scoped styles: often enough
Before adding any framework, consider whether you need one. Astro’s scoped <style> blocks give you component-level CSS with no naming collisions, class:list for conditional classes, define:vars for prop-driven values, and modern CSS (nesting, :has(), container queries, clamp()) handled by the browser and Vite. A small global stylesheet with tokens and base typography covers the rest.
That combination ships the least CSS of any option, because each page only includes styles for the components it renders. The Astro styling guide and which styling approach to use go deeper, and the styling docs show where styles live in a project.
How to choose an Astro CSS framework
Pick based on how your team writes markup, not on popularity:
- Choose UnoCSS if you want utility classes with custom rules, shortcuts and icon presets.
- Choose Open Props if you like writing CSS but want a well-designed set of tokens to start from.
- Choose Pico CSS if most of your HTML is semantic or comes from Markdown, and design polish is secondary.
- Choose Bootstrap or Bulma if your team already knows them and you need many standard components quickly.
- Choose Panda CSS if you want typed, token-driven styles in a large TypeScript codebase.
- Choose scoped CSS only if the site is content-focused and you want the smallest possible output.
Whatever you pick, it is easier to evaluate on a real site than in a blank project. Most Astro themes in the catalog are built with Tailwind CSS, so they are also a useful reference when you are comparing Tailwind against an alternative. The official Astro styling guide on docs.astro.build lists the CSS integrations Astro supports directly.
FAQ
What is the best CSS framework for Astro?
There is no single best one. Tailwind CSS is the most widely used, UnoCSS is the closest alternative, and many content sites need nothing beyond Astro’s scoped styles. Choose based on how your team prefers to write markup.
Can I use Bootstrap with Astro?
Yes. Install bootstrap, import its CSS in your base layout, and import only the JavaScript components you need inside a <script> tag so Astro bundles them.
Does UnoCSS work with Astro?
Yes. UnoCSS ships an Astro integration at unocss/astro. Add it to integrations in astro.config.mjs and configure presets in uno.config.ts.
Do I need a CSS framework for an Astro site?
No. Astro’s scoped <style> blocks, a small global stylesheet for tokens and base styles, and modern CSS features are enough for most sites, and they ship the least CSS.
Can I use two CSS frameworks in one Astro project?
You can, but it is rarely worth it. Two frameworks mean conflicting resets, duplicated utilities and more CSS to download. A common exception is a token library like Open Props alongside scoped component styles.