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.
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, Hero Centered, Pricing Three Tier, and 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:
- Duplicate DOM and hydration payloads. Every
client:loadisland 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. - 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. - Slower time-to-interactive on mid-tier devices. An accordion or mobile drawer placed above the fold cannot respond to a tap until
react-domfinishes downloading, parsing, and hydrating the island. Native<details>andpopoverrespond on frame one.
You can inspect all 371 entries in the Haze UI catalog or read the side-by-side breakdown on 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>withcommandandcommandfor: Opens modals into the browser top layer viashowModal(), traps focus natively inside the top layer, restores focus to the trigger when closed, and supportsclosedby="any"for light-dismiss backdrop clicks. See Dialog and Alert Dialog.- The
popoverattribute and CSS Anchor Positioning: Replaces heavy JavaScript dropdown positioning withpopovertargettriggers andanchor-name/position-anchordeclarations, with automatic viewport flip fallbacks viaposition-try-fallbacks. See Popover and Dropdown Menu. - Exclusive
<details name="...">with::details-content: Enables smooth height animations toheight: autousinginterpolate-size: allow-keywords, grouping accordion items without a single line of click-handler JavaScript. See Accordion.
Here is what an interactive dialog trigger and modal surface look like when installed into your project with @haze/dialog:
---
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, keyboard roving tabindex across 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:
- Usable baseline without JavaScript. In Tabs, panels render as anchor targets (
href="#panel-id"), using CSS:targetrules so switching tabs works even with scripts disabled. Once the inline script loads, it setsdata-enhanced, assigns ARIArole="tablist"/role="tab"/role="tabpanel"attributes, and animates the sliding indicator. - Scoped by
data-haze-*attributes, never frameworks. Scripts attach cleanly to DOM roots viadata-enhancedguards and re-initialize onastro:page-loadso Astro View Transitions never double-bind listeners. - One house styling system. Every component uses semantic Tailwind CSS v4 tokens (
bg-card,text-muted-foreground,border-border) defined once in Theming, never raw hex values or framework-specific CSS-in-JS.
For complex interactive patterns, inspect the 12-route Tidewell SaaS 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:
- 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 and keep
@astrojs/reactuninstalled. - 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 ownsrc/components/haze/folder. - Do coding agents assist your workflow? Pick a library exposing structured metadata,
/llms.txt, and per-component.mddocumentation—covered in detail in our guide on AI-ready component libraries.
Ready to start? Browse Components or follow our step-by-step walkthrough on using the shadcn CLI in Astro without React.
Frequently asked questions
Do Haze UI components require React or @astrojs/react?
No. Every Haze UI component and page block installs as a plain .astro source file. You only need Astro and Tailwind CSS v4 via @tailwindcss/vite.
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.
Components & blocks mentioned
Browse all entries- DialogUI
Native modal with a title, description, body, and footer actions.
npx shadcn@latest add @haze/dialog - TabsUI
Tab list switching panels horizontally or vertically in pill or underline style, with sizing, badges, and in-page link fallback.
npx shadcn@latest add @haze/tabs Button that opens a short list of links, with group headings, leading icons, trailing hints, a destructive style and one level of submenus.
npx shadcn@latest add @haze/dropdown-menuList of expandable items built from an array, in three variants, with a chevron or plus icon and optional single-open behavior.
npx shadcn@latest add @haze/accordionCentered headline, linked announcement badge, two CTAs and a raised image placeholder. Text rises in on load, then the placeholder.
npx shadcn@latest add @haze/hero-centeredThree plan panels in one row with equal heights and aligned buttons. The middle plan has a stronger border and a badge.
npx shadcn@latest add @haze/pricing-three-tier
Continue reading
7 min read
9 min read
10 min read