🔥 All-Access Pass — $199 USD (Regular $499) · Unlock all 2,836 Astro themes ➔
komal.nakrani
Get All-Access Pass ($199)
ThemesCategoriesDocsBlogTips & TricksPricingGet All-Access Pass ($199)
Components & Islands••By Komal Nakrani

Astro UI Library Options: Component Kits That Work

Which Astro UI library should you use? CSS-only kits, Astro-native components, React libraries like shadcn/ui, and web components compared, with setup code.

#Astro#Astro UI Library#Components#Tailwind CSS#shadcn/ui

The best Astro UI library depends on how much JavaScript you’re willing to ship. CSS-only kits such as daisyUI work in .astro files with zero client JavaScript; Astro-native kits such as Starwind UI give you .astro components you copy into your project; React libraries such as shadcn/ui work as hydrated islands; and web component libraries such as Web Awesome (the successor to Shoelace) work anywhere without a framework integration. For content sites, start with CSS-only or Astro-native components and use framework libraries only for complex interactive widgets.

This guide groups the libraries that work well with Astro by how they run, shows the setup for each type, and explains the trade-offs.

Key Takeaways

  • Any React, Vue, Svelte or Solid UI library works in Astro, but each component needs a client:* directive to be interactive.
  • CSS-only libraries and .astro component kits ship no framework runtime, which suits Astro’s defaults.
  • Copy-in libraries (shadcn/ui, Starwind UI) put the source in your repo, so you can edit every component.
  • Web components hydrate themselves and need no Astro integration.
  • Don’t mix several UI libraries on one site; the CSS and runtime costs add up.

Four kinds of Astro UI library

Type Examples Client JavaScript Runs in .astro files Best for
CSS-only / class-based daisyUI, Bulma, Pico CSS None, or tiny optional scripts Yes Content sites, marketing pages
Astro-native components Starwind UI, community .astro kits Small scripts where needed Yes Astro-first projects
Framework component libraries shadcn/ui, Radix, MUI, Headless UI, Vuetify, Bits UI The framework plus the library Inside islands App-like widgets, reused React/Vue code
Web components Web Awesome / Shoelace, Material Web Per-component custom elements Yes Framework-agnostic design systems

The table shows the main decision. Astro’s advantage is shipping little JavaScript, so libraries that render as HTML and CSS fit naturally. Libraries built on React or Vue work fine, but every component you use interactively brings its framework along.

CSS-only libraries

daisyUI

daisyUI is a Tailwind CSS plugin that adds component classes (btn, card, modal, navbar) and themes. Because it’s just classes, it works directly in .astro templates with no hydration:

/* src/styles/global.css */
@import "tailwindcss";
@plugin "daisyui";
---
// src/components/PricingCard.astro
const { plan, price } = Astro.props;
---
<div class="card bg-base-100 shadow-sm">
  <div class="card-body">
    <h2 class="card-title">{plan}</h2>
    <p>{price} per month</p>
    <div class="card-actions justify-end">
      <a class="btn btn-primary" href="/signup/">Choose {plan}</a>
    </div>
  </div>
</div>

Interactive pieces such as modals and dropdowns use native HTML (<dialog>, <details>) where possible, so many need no JavaScript at all. Setup assumes Tailwind CSS 4; see the Tailwind CSS Astro setup guide.

Other class-based options

  • Pico CSS styles semantic HTML with almost no classes. Good for docs, prototypes and small sites.
  • Bulma is a classic CSS framework with no JavaScript. Interactive parts like burger menus need a few lines of your own script.
  • Flowbite pairs Tailwind classes with a small vanilla JavaScript file for dropdowns, modals and tabs. Load its script once in your layout.

Astro-native component kits

Starwind UI

Starwind UI provides accessible components written as .astro files with Tailwind CSS, installed through a CLI that copies the source into your project, similar to how shadcn/ui works for React. Interactivity uses small scripts in the components rather than a framework runtime.

The advantage of copy-in components is ownership: they’re files in src/components/, so you edit them like your own code and never fight a library’s API. The cost is that updates are manual.

Building your own small kit

For many sites, the best UI library is a dozen components you write once: Button, Card, Badge, Tabs, Accordion, Modal. Astro makes this practical because a component is HTML with scoped styles. Our component articles walk through several, including an accessible modal dialog, tabs and an accordion. Each uses native elements and a small script.

Framework component libraries

shadcn/ui with React

shadcn/ui is a set of React components built on Radix primitives and Tailwind CSS, copied into your project with its CLI. It has official setup instructions for Astro. First add React:

# terminal
npx astro add react
npx shadcn@latest init
npx shadcn@latest add dialog button

Then use components inside React islands:

// src/components/ContactDialog.tsx
import { Button } from '@/components/ui/button';
import {
  Dialog,
  DialogContent,
  DialogHeader,
  DialogTitle,
  DialogTrigger,
} from '@/components/ui/dialog';

export default function ContactDialog() {
  return (
    <Dialog>
      <DialogTrigger asChild>
        <Button>Contact us</Button>
      </DialogTrigger>
      <DialogContent>
        <DialogHeader>
          <DialogTitle>Get in touch</DialogTitle>
        </DialogHeader>
        <p>We reply within one business day.</p>
      </DialogContent>
    </Dialog>
  );
}
---
// src/pages/contact.astro
import ContactDialog from '../components/ContactDialog.tsx';
---
<ContactDialog client:visible />

The @/ import alias needs a paths entry in tsconfig.json; the shadcn CLI prompts for it. Remember the rule from React in Astro: components without a directive render as static HTML, so a dialog without client:* won’t open.

Purely presentational shadcn components (Card, Badge, Separator) can render without a directive and ship no JavaScript.

Other framework libraries

  • Radix UI, React Aria, Headless UI: unstyled, accessible primitives for React. Pair with Tailwind CSS.
  • MUI, Chakra UI, Mantine: full design systems for React. They rely on runtime styling or context providers, and each island is a separate React root, so providers must wrap each island. They’re heavier than Astro sites usually need.
  • Vuetify, PrimeVue, Naive UI: Vue libraries, through @astrojs/vue.
  • Bits UI, Skeleton, Flowbite Svelte: Svelte libraries, through @astrojs/svelte.

The context-provider point matters more than it seems. A library that needs a <ThemeProvider> at the root has no single root in Astro, because every island is independent. Wrap each island’s content in the provider, or choose a library that doesn’t need one.

Web component libraries

Web components are custom HTML elements that register themselves with JavaScript. Astro renders them as regular tags, and the browser upgrades them when the library loads:

---
// src/layouts/BaseLayout.astro
---
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <slot name="head" />
  </head>
  <body>
    <slot />
    <script>
      import '@awesome.me/webawesome/dist/components/button/button.js';
      import '@awesome.me/webawesome/dist/components/dialog/dialog.js';
    </script>
  </body>
</html>

No client:* directive is needed and no Astro integration is installed; import only the components you use so the bundle stays small. Web Awesome is the successor to Shoelace; check its install docs for the current package path. Material Web and other custom-element libraries work the same way.

The trade-off is server rendering: most web components render their internals in the browser, so their content isn’t in the initial HTML. Avoid them for content that must be visible before JavaScript runs.

How to choose an Astro UI library

  1. Content site, Tailwind already in use: daisyUI or Flowbite, plus a few of your own .astro components.
  2. Astro-first project that wants a component kit: Starwind UI or your own kit.
  3. A few complex widgets (date pickers, comboboxes, data tables): a React or Vue library, used only in those islands.
  4. Existing React design system to reuse: that system, inside islands, with static rendering for presentational parts.
  5. A design system shared across several frameworks: web components.

Whatever you pick, measure the JavaScript it adds with npm run build and the bundle size analysis tip.

Komal themes are built from plain .astro components with Tailwind CSS (most use Tailwind CSS 3) and no UI framework, so you can add any of these libraries where you need it; browse Astro themes or check the styling docs. The official framework components guide explains how islands render library components.

FAQ

Does shadcn/ui work with Astro?

Yes. Add React with npx astro add react, run the shadcn CLI to add components, and use them in .tsx files. Interactive components such as Dialog and Select need a client:* directive where you render them in an .astro file.

What is the best UI library for Astro?

For content sites, a CSS-based library such as daisyUI or Astro-native components such as Starwind UI, because they ship little or no JavaScript. For complex interactive widgets, a React or Vue library used only in the islands that need it.

Can I use Material UI with Astro?

Yes, through @astrojs/react, but each MUI component that needs interactivity must be in a hydrated island, and theme providers must wrap each island separately. For most Astro sites a lighter library is a better fit.

Do web components work in Astro?

Yes. Astro renders custom elements as normal HTML tags, and the library’s script upgrades them in the browser. Import the components in a <script> tag; no integration or client directive is needed.

Does Astro have its own component library?

No. Astro provides the component format and built-in components like <Image /> and <Code />, but no UI kit. Community kits such as Starwind UI fill that gap.