# Astro UI Libraries Compared: Plain .astro Components vs. React Islands

> Why plain .astro components outperform hydrated React UI islands on Astro sites, and when a React island still makes sense.

- Category: Architecture · Published: 2026-11-23 · Updated: 2026-11-23 · Reading time: 9 min read
- Canonical URL: https://hazeui.com/guides/astro-ui-libraries-compared-zero-js-vs-react-islands
- Tags: astro, ui-library, zero-js, architecture, performance

## Executive Summary

Plain .astro UI libraries like Haze UI compile into HTML and CSS at build time, shipping zero framework runtime JavaScript for accordions, dialogs, popovers, and layouts. React-based UI libraries in Astro require @astrojs/react plus client:* hydration directives, adding framework bundle weight and delaying interactivity until JavaScript parses and hydrates.

Every team adopting Astro runs into the same decision during week one: pull in `@astrojs/react` so you can drop in a familiar React component kit, or commit to plain `.astro` components from the start.

On paper, adding React to Astro looks harmless because Astro promises partial hydration. In practice, UI primitives rarely stay isolated inside a single leaf component. Once your navbar, modal dialogs, dropdown menus, tabs, pricing toggles, and accordions all import React hooks or JS primitive wrappers, half your marketing site and most of your app chrome ends up wrapped in `client:load` or `client:idle`.

You end up paying the hydration cost of a single-page application on a framework you picked to avoid one.

## How plain .astro libraries differ from hydrated React islands

Plain `.astro` components render on the server or at static build time into semantic HTML and CSS, relying on native browser controls for disclosure, layering, and focus management. React island libraries serialize props into the HTML payload, ship the React runtime plus component packages to the browser, and bind virtual DOM event handlers after hydration finishes.

That architectural difference shows up in three places users actually feel: First Input Delay / Interaction to Next Paint (INP), HTML weight from serialized island props, and keyboard reliability when scripts fail or load slowly on mobile networks.

| Dimension | Plain `.astro` UI (Haze UI) | React Islands in Astro (`client:load`) | Unstyled Headless Primitives |
|---|---|---|---|
| **Framework runtime** | None (0 KB React/Vue/Svelte) | React + ReactDOM + UI wrapper JS | Depends on host framework |
| **Interactive overlays** | Native `<dialog>`, `popover`, `<details>` | Portal divs + JS focus trap + scroll lock | JS state + focus management |
| **Styling architecture** | Tailwind CSS v4 tokens (`src/styles/haze.css`) | Tailwind or CSS-in-JS | You write all CSS and tokens |
| **Code ownership** | Source `.astro` files copied into `src/` | Often npm package or JSX files requiring `@astrojs/react` | Package dependency |
| **Pre-hydration behavior** | Works immediately on first HTML byte | Controls are inert until hydrated | Inert until hydrated |
| **AI agent discovery** | `llms.txt`, `.md` twins, shadcn registry JSON | Prose docs or framework-specific MCP | Framework docs |

Take a standard landing page composed with Haze UI blocks: [Navbar Simple](/blocks/navbar-simple), [Hero Centered](/blocks/hero-centered), [Pricing Three Tier](/blocks/pricing-three-tier), and [FAQ Accordion](/blocks/faq-accordion). Notice what happens when you view page source. The mobile menu uses `popovertarget` and `popover`. The FAQ accordion uses native `<details name="faq">`. Hover states, press feedback (`active:scale-[0.97]`), and disclosure transitions run purely in CSS. Zero framework islands mount on load.

## Why React UI kits drag extra weight into Astro

React component kits were designed around a specific assumption: JavaScript already runs the entire page. Under that model, shipping a 15 KB focus trap library, a floating-UI positioning engine, and a portal manager per overlay makes total sense because React already owns the DOM.

Inside Astro, that assumption breaks down:

1. **Duplicate DOM and hydration payloads.** Every `client:load` island embeds JSON-serialized props inside `<astro-island>` attributes. Pass three FAQ items or a pricing matrix into a React component and that data appears twice—once in rendered HTML and once in the island hydration attribute.
2. **Cascade breaks across shadow/portal boundaries.** Many React overlay primitives render portals at the end of `<body>` and compute coordinates in JavaScript. If your page layout relies on Astro View Transitions or native top-layer semantics, portaled React subtrees require extra cleanup glue.
3. **Slower time-to-interactive on mid-tier devices.** An accordion or mobile drawer placed above the fold cannot respond to a tap until `react-dom` finishes downloading, parsing, and hydrating the island. Native `<details>` and `popover` respond on frame one.

You can inspect all 371 entries in the [Haze UI catalog](/browse) or read the side-by-side breakdown on [Compare](/compare) to see how each category maps to native HTML.

## Native HTML primitives that replaced JavaScript libraries

Modern browsers shipped the platform features that forced frontend teams to rely on React overlay wrappers five years ago. Three standards carry almost every everyday UI pattern in Haze UI:

- **`<dialog>` with `command` and `commandfor`**: Opens modals into the browser top layer via `showModal()`, traps focus natively inside the top layer, restores focus to the trigger when closed, and supports `closedby="any"` for light-dismiss backdrop clicks. See [Dialog](/ui/dialog) and [Alert Dialog](/ui/alert-dialog).
- **The `popover` attribute and CSS Anchor Positioning**: Replaces heavy JavaScript dropdown positioning with `popovertarget` triggers and `anchor-name` / `position-anchor` declarations, with automatic viewport flip fallbacks via `position-try-fallbacks`. See [Popover](/ui/popover) and [Dropdown Menu](/ui/dropdown-menu).
- **Exclusive `<details name="...">` with `::details-content`**: Enables smooth height animations to `height: auto` using `interpolate-size: allow-keywords`, grouping accordion items without a single line of click-handler JavaScript. See [Accordion](/ui/accordion).

Here is what an interactive dialog trigger and modal surface look like when installed into your project with `@haze/dialog`:

```astro
---
import Dialog from "../components/haze/ui/dialog.astro";
import Button from "../components/haze/ui/button.astro";
---

<Dialog
  id="delete-project"
  title="Archive Tidewell workspace?"
  description="Team members will keep read-only access to exported assets."
  triggerLabel="Archive workspace"
  role="alertdialog"
>
  <p class="text-muted-foreground">
    You can restore archived workspaces from billing settings within 30 days.
  </p>
  <Fragment slot="footer">
    <Button variant="ghost" command="close" commandfor="delete-project">Cancel</Button>
    <Button variant="destructive" command="close" commandfor="delete-project">Archive</Button>
  </Fragment>
</Dialog>
```

Notice there is no `client:load`, no `useState`, and no `@astrojs/react` integration anywhere in `astro.config.mjs`. A tiny 20-line fallback script in `dialog.astro` only kicks in if the visitor's browser lacks native `command` or `closedBy` support.

## Progressive enhancement when scripts actually help

Zero-framework does not mean pretending JavaScript never improves usability. Some interactions—type-ahead filtering inside [Command Palette](/blocks/command-palette), keyboard roving tabindex across [Tabs](/ui/tabs), or clipboard copy with live-region announcements—genuinely benefit from JavaScript.

The difference lies in **how** scripts are written inside a portable `.astro` library:

1. **Usable baseline without JavaScript.** In [Tabs](/ui/tabs), panels render as anchor targets (`href="#panel-id"`), using CSS `:target` rules so switching tabs works even with scripts disabled. Once the inline script loads, it sets `data-enhanced`, assigns ARIA `role="tablist"` / `role="tab"` / `role="tabpanel"` attributes, and animates the sliding indicator.
2. **Scoped by `data-haze-*` attributes, never frameworks.** Scripts attach cleanly to DOM roots via `data-enhanced` guards and re-initialize on `astro:page-load` so Astro View Transitions never double-bind listeners.
3. **One house styling system.** Every component uses semantic Tailwind CSS v4 tokens (`bg-card`, `text-muted-foreground`, `border-border`) defined once in [Theming](/docs/theming), never raw hex values or framework-specific CSS-in-JS.

For complex interactive patterns, inspect the 12-route [Tidewell SaaS demo](/demo), which runs full multi-step authentication, analytics filters, project boards, and settings using Astro pages and lightweight vanilla TypeScript.

## When a React island is still the right tool

Honesty matters when picking architecture. Plain `.astro` components are not a universal replacement for rich client state engines. Keep React (or Solid/Svelte) islands for:

- **Multiplayer or canvas editors** where dozens of nodes update at 60 fps from WebSocket deltas.
- **Spreadsheet grids and formula bars** with complex cell dependency recalculation.
- **Rich client-side state machines** that already depend on a React ecosystem SDK such as a third-party map canvas or WebGL viewer.

For everything else—marketing pages, pricing tables, authentication screens, documentation portals, CRUD settings, navigation shells, and even AI tool approval feeds—plain `.astro` components deliver faster loads, smaller HTML, and zero runtime lock-in.

## Choosing the right path for your Astro codebase

Before installing any UI library into an Astro project, run a quick three-question audit on your requirements:

1. **Will 80% of your UI consist of sections, cards, navigation, forms, and dialogs?** Choose an Astro-native library like Haze UI via the [Installation guide](/docs/installation) and keep `@astrojs/react` uninstalled.
2. **Do you want full source ownership without npm lock-in?** Use a shadcn-compatible registry (`npx shadcn@latest add @haze/button`) so components live in your own `src/components/haze/` folder.
3. **Do coding agents assist your workflow?** Pick a library exposing structured metadata, `/llms.txt`, and per-component `.md` documentation—covered in detail in our guide on [AI-ready component libraries](/guides/llms-txt-markdown-twins-shadcn-mcp-for-coding-agents).

Ready to start? Browse [Components](/browse?kind=ui) or follow our step-by-step walkthrough on [using the shadcn CLI in Astro without React](/guides/shadcn-cli-for-astro-without-react).

## Mentioned Haze UI Entries

- [Dialog](https://hazeui.com/ui/dialog.md): Native modal with a title, description, body, and footer actions.
- [Tabs](https://hazeui.com/ui/tabs.md): Tab list switching panels horizontally or vertically in pill or underline style, with sizing, badges, and in-page link fallback.
- [Dropdown menu](https://hazeui.com/ui/dropdown-menu.md): Button that opens a short list of links, with group headings, leading icons, trailing hints, a destructive style and one level of submenus.
- [Accordion](https://hazeui.com/ui/accordion.md): List of expandable items built from an array, in three variants, with a chevron or plus icon and optional single-open behavior.
- [Hero: centered with announcement badge](https://hazeui.com/blocks/hero-centered.md): Centered headline, linked announcement badge, two CTAs and a raised image placeholder. Text rises in on load, then the placeholder.
- [Pricing: three tiers with featured plan](https://hazeui.com/blocks/pricing-three-tier.md): Three plan panels in one row with equal heights and aligned buttons. The middle plan has a stronger border and a badge.

## Frequently Asked Questions

### How do interactive components work in Astro without a frontend framework?

Haze UI builds modals on native <dialog> with command/commandfor attributes, menus and popovers on the Popover API with CSS anchor positioning, and accordions on <details name>. Where progressive JavaScript adds value, such as ARIA tab switching or copy-to-clipboard, components use tiny inline vanilla TypeScript scripts with zero external runtime.

### When should I still use a React island inside an Astro project?

Use a React island when an interface genuinely behaves like a long-lived client application—such as a collaborative canvas, spreadsheet formula engine, or complex local state graph—rather than marketing sections, forms, navigation, or standard product UI.

### Can I mix Haze UI .astro blocks with existing React islands?

Yes. Because Haze UI uses standard shadcn semantic CSS variables (--background, --card, --primary, --border, --radius) inside src/styles/haze.css, plain .astro blocks and React components share the exact same dark and light tokens.
