Skip to main content
239

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Themes
Web docs

Framework guide: Astro

The reference implementation for Lumen UI, with the complete component catalog, automatic component CSS, and controllers that load on demand.

Version
v6.0.0
Astro
5+
JS on static pages
0 B

Start with a complete Astro project

The free MIT starter includes landing page, ecommerce, dashboard, portfolio, and blog templates. Explore twelve Lumen themes in light and dark mode, then edit the same source in your own project.

Installation

Astro components import their own CSS. Install @santi020k/lumen separately as a development dependency for CLI commands. Mount UIPrimitives once in your root layout only if you use interactive primitives; do not add it beside every component.

  • pnpm
    pnpm add @santi020k/lumen-astro
  • npm
    npm install @santi020k/lumen-astro
  • yarn
    yarn add @santi020k/lumen-astro

Usage Example

astro
---
import { Button, Card, Input, Label } from '@santi020k/lumen-astro'
---

<Card>
  <Label for="email">Email</Label>
  <Input id="email" type="email" placeholder="[email protected]" />
  <Button>Subscribe</Button>
</Card>

Overview

  • Reference implementation for markup, props, automatic component CSS, and selective progressive enhancement.
  • Await LumenInitUiPrimitives(scope) for markup you add later; ui:ready follows completion and ui:runtime-error reports failed enhancement.
  • Mount UIPrimitives once in the root layout for interactive primitives and CustomEvents.
  • Use lumen add Component or lumen add recipe-name --target astro when you want local .astro starter files.

Progressive Enhancement Runtime

Interactive components like Dialogs, Popovers, Tabs, and Selects rely on a lightweight, vanilla JavaScript runtime. Mount <UIPrimitives /> once in your Astro root layout to wire up keyboard navigation, focus trapping, and disclosure state for matching components. Controllers load on demand, so initialization is asynchronous. Await window.LumenInitUiPrimitives(scope) for application-created markup; ui:ready follows completion and ui:runtime-error reports failures.

astro
---
import { Button, Card } from '@santi020k/lumen-astro'
import UIPrimitives from '@santi020k/lumen-astro/runtime'
---

<UIPrimitives />
<Card><Button>Save</Button></Card>
Switch content

Try the tabs

Focus a tab and use the arrow keys to switch views.

Your workspace is ready.

No new activity today.

Tabs API and examples
Open an overlay

Try the dialog

Open help, press Escape to dismiss it, then check where focus returns.

Workspace help

Keep your team settings in one place.

Dialog API and examples
Native HTML behavior

Try the disclosure

Click the question or focus it and press Enter. This also works without JavaScript.

Does this need JavaScript?

Native details can open and close without the runtime.

Accordion API and examples

Copy a demo · Astro snippets assume styles and UIPrimitives are already mounted in your root layout.

astro
---
import { Tabs, TabsList, TabsPanel, TabsTrigger } from '@santi020k/lumen-astro'
---

<Tabs initialValue="overview">
  <TabsList aria-label="Workspace view">
    <TabsTrigger value="overview">Overview</TabsTrigger>
    <TabsTrigger value="activity">Activity</TabsTrigger>
  </TabsList>
  <TabsPanel value="overview">
    <p>Your workspace is ready.</p>
  </TabsPanel>
  <TabsPanel value="activity">
    <p>No new activity today.</p>
  </TabsPanel>
</Tabs>

Route delivery

Static content ships no JavaScript, and interactive routes load only the controllers they use. Compare static content, a dialog, and code tabs using the same built fixture app.

Lumen 5.0 baselineRoute delivery snapshot

gzip bytes

Astro route asset measurements, Lumen 5.0 baseline, November 5, 2026, in gzip bytes
Route fixtureInitial JavaScriptInitial CSSFirst interaction
Static Card and ButtonContent without a controller
0 B7,025 BNo interaction
DialogOne interactive primitive
5,448 B8,705 B0 Badditional assets
Code tabs with scroll cuesA composed interactive example
9,638 B8,071 B0 Badditional assets

How it’s measured

Cold Chromium loads with selective CSS and CSS inlining disabled. Assets are individually compressed with gzip level 9.

Read the measurement method

Read it in context

The static fixture omits the root runtime. Shared chunks and app setup affect the result. These local fixture sizes were measured at revision b328b53f, when Lumen 5 introduced per-route loading. Lumen 6 keeps the same loading model; run pnpm run measure:route-delivery to measure your revision.

Web docsFull catalog