For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /dolan/index.md.

UI Components

UI components are ready-made buttons, form controls, dialogs, charts and more for AngularLynx apps. A CLI copies their source into your project, so you own the code and can change anything. It's the same idea as shadcn/ui.

Two package names are involved:

  • @blotch/ui is the component source. You never install it.
  • @blotch/dolan is the CLI. It carries a copy of that source and writes it into src/components/ui/.

Before you start

The components are styled with Tailwind CSS. If you said yes to Tailwind when you created the app, you're ready. Otherwise, set it up first: see Tailwind CSS.

Installation

1. Set up dolan.

npx @blotch/dolan init

Press Enter to accept both default folders. It writes dolan.config.json, copies three theme files into src/styles/, and installs @blotch/dolan as a dependency:

  • default.css: the light theme's colors, corner radius and text size
  • dark.css: the dark theme's colors
  • tailwind.css: maps those colors to Tailwind classes such as bg-primary. An app on Tailwind 3 gets tailwind-plugin.ts, a Tailwind plugin, instead.

Copied components import cn() and animation helpers from @blotch/dolan, so your app needs it to build, not only to run commands. Once it's installed, npx dolan runs it too.

In CI, a script or an AI agent, init asks nothing and takes the default folders. Add --yes to skip the questions in a terminal too, and --components or --theme to choose other folders. See init.

2. Import the theme, after Tailwind's own imports:

src/styles.css
@layer theme, base, components, utilities;
@import 'tailwindcss/theme.css' layer(theme);
@import 'tailwindcss/utilities.css' layer(utilities);
@import '@blotch/angular-lynx/tailwind.css';
@import './styles/default.css'; 
@import './styles/dark.css'; 
@import './styles/tailwind.css'; 

With dark.css imported, the app follows the phone's light or dark appearance. See Theming.

3. On Tailwind 3, add the Tailwind plugin to your config instead, and import only the colors:

tailwind.config.ts
import type { Config } from 'tailwindcss';
import preset from '@lynx-js/tailwind-preset';
import { blotchPlugin } from './src/styles/tailwind-plugin'; 

const config: Config = {
  content: ['./src/**/*.{html,ts}'],
  presets: [preset],
  plugins: [blotchPlugin],
};

export default config;
src/styles.css
@import './styles/default.css';
@import './styles/dark.css';

@tailwind base;
@tailwind utilities;

Put the @import lines first: CSS ignores an @import that comes after other rules.

4. Add components.

npx dolan add button card

Each one lands in src/components/ui/<name>/. Components it depends on come too: button brings spinner. So do the npm packages they import: button installs class-variance-authority.

5. Use them.

src/app/app.ts
import { Component, signal } from '@angular/core';
import { LYNX_ELEMENTS } from '@blotch/angular-lynx';
import { UiButton } from '../components/ui/button';
import {
  UiCard,
  UiCardContent,
  UiCardHeader,
  UiCardTitle,
} from '../components/ui/card';

@Component({
  selector: 'app-root',
  imports: [
    LYNX_ELEMENTS,
    UiButton,
    UiCard,
    UiCardHeader,
    UiCardTitle,
    UiCardContent,
  ],
  template: `
    <view class="h-full bg-background p-6">
      <ui-card>
        <ui-card-header>
          <ui-card-title>Welcome</ui-card-title>
        </ui-card-header>
        <ui-card-content>
          <ui-button (pressed)="increment()">
            Tapped {{ count() }} times
          </ui-button>
        </ui-card-content>
      </ui-card>
    </view>
  `,
})
export class App {
  protected readonly count = signal(0);

  protected increment(): void {
    this.count.update((n) => n + 1);
  }
}
  • The component pages import from ../components/ui/<name>, a path relative to src/app/.
  • Templates use Lynx elements such as <view> and <text> instead of HTML (see Glossary). Import LYNX_ELEMENTS whenever you use them (see Elements).

Good to know

  • Text color doesn't inherit. Lynx passes only font-size down by default, so put a color class such as text-foreground on each of your own <text> elements. The components color their own text.
  • True/false inputs take a bare attribute. <ui-button disabled> is [disabled]="true", as on an HTML element. A two-way value, such as a switch's checked, is a model(), and Angular doesn't let a model take one, so bind it: [checked]="true".
  • Tests come with the code. Once you've set up testing (@blotch/angular-lynx-testing-library), dolan add copies each component's tests too. They cover every line of the component under ng test --coverage, so the copies can stay in your coverage report.
  • Updates are merged, not forced. Run dolan update after upgrading @blotch/dolan. It keeps your edits and asks when both sides changed.

Components

General

  • Button: a tappable button with variants, sizes and a loading state
  • Button Group: connected buttons that act as one toolbar
  • Copy Button: a button that copies text to the clipboard and says it did
  • Icon: 195 vector icons, or your own SVG
  • Typography: text styles for headings, body and captions

Layout

  • Card: a bordered surface with header, content and footer
  • Separator: a thin horizontal or vertical line
  • Accordion: stacked sections that expand one or many at a time
  • Collapsible: one section that shows and hides its content
  • Tabs: panels switched by a row of tab buttons
  • Aspect Ratio: a box that keeps a width-to-height ratio
  • Scroll Area: a scrolling container with edge events

Liquid Glass

  • Glass: Liquid Glass for floating controls, with each platform's fallback
  • Dock: a floating glass tab bar that minimizes as content scrolls
  • Search Field: a glass search field, which the dock can search with at the bottom of the screen
  • Menu: a pull-down menu that grows out of its button
  • Context Menu: a menu that opens on a long press, lifting the element
  • Glass sheets: sheets that float inset at half height and turn opaque at full height
  • Popover: content that grows out of the control that opens it
  • Switch and Slider: controls whose thumb turns to glass while it's dragged
  • Segmented Control: a thumb that lifts into glass as it slides between segments, for toggle groups and tabs

Navigation

  • Nav Drawer: a side menu that slides in
  • Tab Bar: tabs along the bottom that switch routed screens
  • Pagination: page numbers with previous and next buttons
  • Wizard: a task split into steps, under an indicator of where the user is

Data Display

Forms

  • Input: a single-line text field with label, helper text and error
  • Textarea: a multi-line text field that grows with its content
  • Label: a caption for a form control
  • Checkbox: an on/off box with a check mark
  • Radio Group: pick one option from a list
  • Select: pick one option from a bottom sheet, with search for long lists
  • Multi Select: pick any number of options, shown as chips
  • Slider: pick a number in a range
  • Switch: an on/off toggle switch
  • Toggle: a button that stays pressed, alone or in a group
  • Calendar: a month of days to pick one from
  • Date Picker: a field that opens a calendar in a bottom sheet

Feedback

  • Alert: an inline message
  • Alert Dialog: a dialog that asks for confirmation
  • Dialog: a centered modal window
  • Bottom Sheet: a panel that slides up from the bottom
  • Sheet: a bottom sheet with header and footer slots
  • Action Sheet: a list of actions that slides up, or grows out of its button
  • Toast: short messages that appear and go away

Design principles

  • You own the code. Components are plain files in your repo. Edit them like your own.
  • Signals throughout. Inputs use input(), events use output(), and two-way values use model(), so [(value)] and [(checked)] work.
  • Theme tokens, not colors. Components use classes such as bg-primary and text-muted-foreground, defined once in your theme. See Theming.
  • Variants with cva. Variant classes come from class-variance-authority. Components export them, for example buttonVariants.
  • Your classes win. Most components take a class input. It's merged with cn(), so a conflicting class you pass replaces the default.
  • cn() merges as tailwind-merge's twMerge() does, but knows only some kinds of class. It knows those the components use, those that conflict with them, and the margins, sizes and text styles apps often pass. That keeps the rest of tailwind-merge's config out of your app's script.
  • Two classes of another kind in one list are both kept. cn('rotate-45', 'rotate-90') returns both, where twMerge() keeps the last. Where you need that, add tailwind-merge to your dependencies and call twMerge().
  • Lynx elements only. Components are built from <view>, <text>, <svg>, <overlay> and other Lynx elements, never HTML.
  • CLI: every @blotch/dolan command
  • Theming: change colors, radius and dark mode
  • Dynamic Color: the colors of the user's wallpaper on Android
  • Tailwind CSS: set up Tailwind for Lynx