Angular tutorial

Angular 20 standalane components — signal inputs, OnPush change detection, inline templates, zero NgModules, zero CSS.

Whit ye'll big

A wee contact form — labelled input, submit button, two-wey binding, real keyboard an screen-reader behaviour — first bare, then styled, in aboot 10 minutes.

Afore ye stairt

Ye need git, Node 22 or later, an pnpm 10 or later. Onie Angular 20 project wirks — Angular CLI or Analog.

Step 1 — Git the code

git clone https://github.com/LilyDesignSystem/lily-design-system
cd lily-design-system/lily-design-system-angular-headless
pnpm install
pnpm test        # vitest + TestBed, all 571 components
pnpm run build-storybook

The components are flat files in components/ — Button.ts, TextInput.ts — ilkane a standalane component wi an inline template, plus its spec an story. The barrel index.ts re-exports ilka component; pnpm build produces an Angular Package Format bundle bi ng-packagr.

Step 2 — Yer first component

import { Component } from "@angular/core";
import { Button } from "@lilydesignsystem/angular-headless";

@Component({
  selector: "app-save-bar",
  standalone: true,
  imports: [Button],
  template: `<lily-button (click)="save()">Save</lily-button>`,
})
export class SaveBar {
  save() { console.log("saved"); }
}

Ilka component declares a lily-* selector an renders the semantic element wi its class hook — <button class="button" type="button"> here. Inputs are signal-based: label() for an aria-label owerride, className() tae append classes.

Step 3 — Compose a wee form

import { Component, signal } from "@angular/core";
import { Form, Field, TextInput, Button } from "@lilydesignsystem/angular-headless";

@Component({
  selector: "app-contact-form",
  standalone: true,
  imports: [Form, Field, TextInput, Button],
  template: `
    <lily-form label="Contact form" (submit)="handleSubmit($event)">
      <lily-field label="Full name" [required]="true">
        <lily-text-input id="name" label="Full name" [(value)]="name" />
      </lily-field>
      <lily-button type="submit">Save</lily-button>
    </lily-form>
  `,
})
export class ContactForm {
  name = signal("");
}

lily-field taks the visible label as its ain label input raither than a nestit label component — pass it ance, on the field, an the matchin lily-text-inputon label supplies the accessible name. Input-like components expose model() values, sae banana-box [(value)] two-wey binding juist wirks — zoneless-compatible throughoot.

Verified 2026-08-29: an earlier draft nestit a separate Label component inside lily-field, which renders twa labels (ane empty) because lily-field aareadies renders its ain frae the label input — catcht bi checkin the component source. The contact-form composed route is the same pattern, exercised bi real e2e an axe tests.

Check yer wirk: rin the app an the form looks plain — exactly as intendit: styling is still aheid. Press Tab: focus muives through ilka control, the label is announced, an submit wirks. The behaviour is deen; the look is yours, an it's neist.

Step 4 — Style it

Style the class hooks — .button, .text-input, .label, .field — in styles.css, or add a ready-made theme tae the styles array in angular.json / link it in index.html:

<link rel="stylesheet" href="/themes/adobe-spectrum.css" />

Step 5 — See it aw wirkin

The Angular + Analog example app shaws the full catalog wi file-based routin an Vite:

git clone https://github.com/LilyDesignSystem/lily-design-system
cd lily-design-system/lily-design-system-angular-examples
pnpm install && pnpm run dev

Neist steps

Questions alang the wey? The help page is fu o answers — an if a step could be clearer, tell us an we'll gladly improve the tutorial.