AsterUIDocsv1.0.2

Docs / Guides

Getting started

Button example

AsterUI (@fierst/ui) is a source registry for Aster applications. Installing a registry item copies TypeScript, TSX and CSS into your project. Import the named exports from those local files. You can edit, test and version them with the rest of your application.

Install and render your first component

Start at the root of an Aster app with the JSX plugin configured. This site uses @fierst/aster@1.2.3 and @fierst/ui@1.0.2. The Aster package requires Node.js 20.19 or later. Run these commands from the directory that contains your app's package.json.

sh
vp dlx @fierst/ui@1.0.2 init
vp add @lucide/icons
vp dlx @fierst/ui@1.0.2 add button

In src/main.tsx, mount a button into the starter page's #app element.

tsx
import { render } from '@fierst/aster';
import { Button } from './ui/button';
import { initTheme, setTheme } from './ui/theme';

initTheme();
render(
  <Button variant="primary" onClick={() => setTheme({ mode: 'dark' })}>
    Use dark mode
  </Button>,
  document.getElementById('app')!,
);

Run your project's development server (vp dev in the starter). Components import the shared stylesheet automatically. Import ./ui/theme.css yourself on pages that use only the tokens or controller.

Once the button works, inspect the button manifest. Its file list shows the TSX the installer copies, and its dependency list explains why the installation also brings in the icon and theme helpers.