Astro UI 2026

Astro
TypeScript
NPM
CSS
Visit Website

Astro UI is an open-source component library for Astro, published on npm as @parsakafi/astro-ui. It ships 64 accessible components that render to plain HTML, take their entire look from design tokens, and add no client-side runtime.

Astro UI, UI components that feel like the platform
Astro UI home page

Why another component library

Astro’s promise is that a site ships JavaScript only where it needs it. Most component libraries are built for client-side frameworks, so using them in Astro means hydrating a runtime on pages that are mostly static HTML, or maintaining a copy-paste fork. Astro UI starts from the other end: every component is an .astro file that renders on the server, and JavaScript is a scoped exception for the few interactions the platform cannot handle alone, such as a dialog’s focus trap, a toast timer, or the carousel arrows.

The result is a library that feels native to Astro instead of grafted onto it: no hydration directives to forget, no client bundle to justify, and no component API that assumes a client-side application around it.

What’s inside

  • 64 components across 7 categories, plus 25 composed blocks ready to copy.
  • 43 components render pure server-side HTML. The other 21 add a small scoped script, never a runtime.
  • Typed and documented. Every component is an Astro file with a typed props interface and JSDoc, so astro check catches misuse at build time.
  • Subpath exports. @parsakafi/astro-ui/button imports one component; the root export imports the set. Both are tree-shakable by construction.
  • No runtime dependencies. The package ships Astro source and CSS, nothing else.

The catalog covers the seven categories you would expect from an application UI kit:

  • General includes Button, ButtonGroup, Command, Carousel, Clipboard, Kbd, Link.
  • Data display includes Badge, Avatar, Attachment, BeforeAfter, Table, Progress, Bubble, Chart, Empty, Tag, Timeline.
  • Layout includes Card, AspectRatio, ScrollArea, Separator, Accordion, Collapsible, StickySurface.
  • Feedback includes Alert, Spinner, Skeleton, Toast, Banner, NotificationCenter.
  • Forms includes Autocomplete, Combobox, Field, Input, InputGroup, Label, Textarea, Select, Checkbox, Radio, Switch, Toggle, ToggleGroup, RadioGroup, Rating, Slider, DatePicker, TimePicker.
  • Navigation includes Tabs, Breadcrumb, Pagination, Stepper, Tree, Navbar, Sidebar.
  • Overlay includes Dialog, AlertDialog, Sheet, Tooltip, Popover, HoverCard, Lightbox, Menu.

Install

npm install @parsakafi/astro-ui

Import the tokens once in your layout, then use the components:

---
import '@parsakafi/astro-ui/tokens.css'; // required. Semantic tokens and themes.
import '@parsakafi/astro-ui/base.css';   // optional. Focus rings, sr-only, reduced motion.
import { Button, Card } from '@parsakafi/astro-ui';
---

<Card>
    <Button variant="primary" size="lg">Get started</Button>
</Card>

Or import a single component when you want the tightest tree-shaking signal:

import Button from '@parsakafi/astro-ui/button';

The package peers on Astro >=7.0.0 <8.0.0, so any Astro 7.x release works. Astro 6 is not supported or tested.

Design decisions

Tokens are the API

Every color, radius, space, and type size in a component resolves through a --ui-* custom property defined in tokens.css. There is no theme config object and there are no theme or colorScheme props. The contract tests reject those names. Restyling the whole system is a CSS override:

:root {
    --ui-primary: oklch(55% 0.2 290);
    --ui-radius-md: 0.375rem;
}

Theming is the same set of tokens under [data-theme="dark"]; leaving the attribute off follows the operating system. Component-private variables live under the --aui-* prefix, so internal styling can never collide with the public token surface.

Native elements first

The components wrap real platform elements: <button>, <input>, <details>, <dialog>, <hr>, <table>. Dialog, AlertDialog, and Sheet are built on <dialog> and inherit focus containment, Escape handling, and the backdrop. Accordion and Collapsible are <details> elements. Checkbox, Radio, and Switch are native inputs with a styled visual. Keyboard support, focus management, and announced state come from the browser instead of a headless UI layer.

Zero JS by default

Where the platform genuinely falls short, such as roving tabindex in Tabs, the WAI-ARIA menu-button model, the tree view, or the combobox filtering, the component ships a small scoped <script>. Contract tests fail the build on client:* directives, inline handlers, and unguarded browser globals, so the zero-JS claim is enforced rather than promised. Each documentation page states the JavaScript requirement of the component you are reading.

Accessibility as a gate

Semantic HTML comes first and ARIA is added only where semantics fall short. Focus is a :focus-visible outline driven by the ring tokens, prefers-reduced-motion is honored globally, token color pairs target WCAG AA, and data visualizations carry a screen-reader path. Components with keyboard behavior have Playwright interaction specs, and each docs page lists its roles, attributes, and keyboard model.

RTL without overrides

Layout uses logical properties, so direction is a document-level concern rather than a component one. Arrow keys follow the writing direction in the keyboard-navigable components, and the DatePicker renders Gregorian or Persian (Jalali) month grids using Intl.DateTimeFormat. No calendar library and no separate RTL build.

Documentation and blocks

The docs live at astroui.ir and cover the parts you actually configure: installation, the token model, RTL, events, and Tailwind interop. Every component page carries an overview, usage, live demos with the matching code, the full props and slots tables, accessibility notes, and changelog. A token playground lets you edit --ui-* values live and copy the resulting CSS, and Ctrl + K searches the whole catalog. The 25 blocks, including auth screens, settings panels, pricing tiers, analytics dashboards, and FAQ sections, are built only from library components, so they can be copied and re-composed without bringing in another dependency. The changelog tracks every release with a migration table for breaking changes, the releases and roadmap pages show what shipped and what comes next, and the design-principles page states each guarantee with the test that enforces it.

Astro UI component catalog
Component catalog. 64 components across 7 categories
Astro UI composed blocks
Blocks. Page sections composed from library components
Astro UI analytics dashboard block
Analytics dashboard block
Astro UI styling documentation
Styling guide. The token model

What 0.2.0 changed

The first release was a feature drop. 0.2.0 came out of a review of the published package, so it fixes the problems a library only finds once people install it:

  • Package gaps. ./progress was missing from the export map even though the component shipped, SCSS sources and repo-only pages no longer travel in the tarball, and npm run check:pack fails the release when an export target is missing or the package exceeds its size budget.
  • WCAG AA text colors. Colored text on neutral surfaces now uses dedicated --ui-*-text tokens, asserted per theme block in tests/contrast.test.ts. The dark brand palette shifted slightly so white text stays readable.
  • Accessible names. Badge uses role="img" when labelled, Combobox always names its trigger, Command points aria-activedescendant at the highlighted option, and Checkbox sets the native indeterminate property.
  • Localization hooks. labels props on Pagination, Carousel, DatePicker, Autocomplete, Combobox, Textarea, and Lightbox merge over their English defaults, and Chart takes uiLabels for the zoom toolbar and fallback tables.
  • One live region. The toaster renders a single aria-live="polite" stack, and only while notifications exist, so screen readers announce each toast once.
  • Progress. A new width prop, an accessible task name, and color="dynamic", which mixes the fill from error to success through the CSS progress() function.
  • A safer Button. The default type is now button instead of submit, so a component dropped into an existing form no longer submits it by accident.

Quality gates

The library is tested like a product, not a side project. astro check type-checks both the library and the docs site. Biome and ESLint run with zero warnings allowed. Vitest covers unit behavior and static contracts: export-map parity, Node self-resolution, token drift, prop vocabulary, SSR safety, markup rules, WCAG contrast pairs for every theme block, and accessible-name precedence. Playwright covers the interactive components with role-based locators, and Chromium visual baselines compare light and dark rendering. npm run check:pack inspects the tarball before publish, and CI type-checks and tests against both the Astro 7.0.0 peer floor and the current dev version.

Light and dark, one token set

Astro UI in light theme
The same page in light theme. No component changes, only tokens
Astro UI in dark theme
Dark theme. Every surface, border, and accent comes from --ui-* tokens

Project details

The 0.x versioning is deliberate: the API settles in public before the project commits to full SemVer stability. 0.2.0 already carries intentional breaking changes, and each one ships with a migration entry in the changelog.

Headshot of Parsa

Hi, I'm Parsa. I'm a software engineer, and I build and fix web apps for WooCommerce store owners, WordPress product teams, and Laravel startups that need a senior contractor they can ship with this week. You can follow me on X, see some of my work on GitHub, or read more about me on about page.