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/button.md.

Button

A tappable button with five solid styles, three Liquid Glass styles, five sizes, and disabled and loading states.

Installation

npx @blotch/dolan add button
import { UiButton } from '../components/ui/button';

This also adds Spinner, which shows while the button is loading, Icon, and Glass, which draws the glass variants. Button imports class-variance-authority (see Installation).

Usage

src/app/app.ts
import { Component, signal } from '@angular/core';
import { UiButton } from '../components/ui/button';

@Component({
  selector: 'app-root',
  imports: [UiButton],
  template: `
    <ui-button [loading]="saving()" (pressed)="save()">
      {{ saving() ? 'Saving...' : 'Save changes' }}
    </ui-button>
  `,
})
export class App {
  protected readonly saving = signal(false);

  protected save(): void {
    this.saving.set(true);
  }
}
  • pressed fires on tap. It doesn't fire while the button is disabled or loading.
  • Put plain text inside. The button wraps it in a <text> in the variant's label color.
  • Don't wrap the text in a <view>. Lynx text takes its color only from a <text> directly around it, so text inside your view draws in the default black, which barely shows on a dark button. For an icon, use <ui-icon>. For a spinner, use loading.
  • The button shrinks slightly while a finger is down, on every platform.

Variants

<ui-button variant="default">Default</ui-button>
<ui-button variant="destructive">Delete</ui-button>
<ui-button variant="outline">Outline</ui-button>
<ui-button variant="secondary">Secondary</ui-button>
<ui-button variant="ghost">Ghost</ui-button>

Glass

Liquid Glass buttons, for controls that float over your content, like SwiftUI's glass button styles:

<ui-button variant="glass">Edit</ui-button>
<ui-button variant="glass-prominent">Done</ui-button>
<ui-button variant="glass-clear">Save</ui-button>
  • glass is regular glass, SwiftUI's .glass. Use it for most floating buttons.
  • glass-prominent is tinted with the theme's glass-tint, the primary color by default, like .glassProminent. Keep it for the screen's main action.
  • glass-clear is clear glass, for buttons over photos and video. It sits on a dark dimming layer (glass-dim), so its white label stays legible over bright content.
  • The glass reacts to touch. On iOS 26 it swells and brightens under the finger. Elsewhere the button shrinks, as the solid ones do.
  • Glass belongs on the layer above content. Put glass buttons over a photo, a map or a scrolling list, not in a form.

What each platform draws:

Platformglass and glass-clearglass-prominent
iOS 26 and laterLiquid Glass, drawn by iOSLiquid Glass in the tint
iOS 15 to 25The thin blur material, dark for glass-clearA filled button
AndroidA Material 3 filled tonal buttonA Material 3 filled button
Android, with provideGlass()Glass without the refractionGlass in the tint
Web previewLiquid Glass, drawn with WebGLLiquid Glass in the tint

On Android the glass variants are Material buttons unless your app opts into glass: fully rounded, flat, with Material's pressed state layer instead of a shrink.

Sizes

<ui-button size="sm">Small</ui-button>
<ui-button size="default">Default</ui-button>
<ui-button size="lg">Large</ui-button>
<ui-button size="icon">+</ui-button>
<ui-button size="icon-circle" accessibility-label="Search">
  <ui-icon name="search" />
</ui-button>
  • The default is 48px tall, a full touch target on iOS and Android, and as tall as a field such as Input or Select, so a button beside one lines up.
  • lg is 56px, for a screen's main action, such as Continue at the bottom of a form.
  • sm is 36px, for a button inside a row or a card. Its touch target is still 48px: it reaches 6px past the button on every side.
  • icon makes a 48px square button for a single character or icon.
  • icon-circle makes a circle for one icon.
  • Glass buttons are capsules, so a glass button in either icon size is a circle.

Icons

Put a <ui-icon> in the button. It takes the label's color:

<ui-button variant="glass">
  <ui-icon name="share-2" />
  Share
</ui-button>

<ui-button variant="secondary">
  Next
  <ui-icon name="arrow-right" trailing />
</ui-button>

<ui-button variant="glass" size="icon-circle" accessibility-label="Add">
  <ui-icon name="plus" />
</ui-button>
  • The icon fits the button's size: 20px beside a default button's label, 16px in a small button, and 24px in a large one or on its own. Set the icon's size to choose another.
  • An icon goes before the label, wherever you write it.
  • Add trailing to put it after the label, for an icon that points onward, such as Next or Open. A button can have one on each side.
  • In an icon size, the button shows the icon alone. Give it an accessibility-label, which a screen reader says instead.
  • The icon can be your own SVG, such as a sign-in provider's mark: <ui-icon [svg]="githubMark" /> (see Your own SVG).

Disabled and loading

<ui-button disabled>Disabled</ui-button>

<ui-button [loading]="saving()">
  {{ saving() ? 'Saving...' : 'Save' }}
</ui-button>

Both dim the button to 50% and ignore taps. A glass button dims its label and keeps the glass, as iOS does.

loading also shows a spinner in the label's color. It goes before the label, in place of a leading icon, and the label stays, so change it to say what's happening. A trailing icon stays too. In an icon size, the spinner replaces the icon.

Custom classes

<ui-button class="w-full">Continue</ui-button>

Your classes are merged onto the button's container and replace any default they conflict with.

Button styles on your own view

buttonVariants() returns the container classes for a solid variant and a size. Use it to style a view that isn't a <ui-button>, and color its text yourself. Glass needs a <blur-view ui-glass>, which classes can't draw.

src/app/settings-link.ts
import { Component } from '@angular/core';
import { LYNX_ELEMENTS } from '@blotch/angular-lynx';
import { buttonVariants } from '../components/ui/button';

@Component({
  selector: 'app-settings-link',
  imports: [LYNX_ELEMENTS],
  template: `
    <view [class]="linkClass">
      <text class="text-sm font-medium text-foreground">Settings</text>
    </view>
  `,
})
export class SettingsLink {
  protected readonly linkClass = buttonVariants({
    variant: 'outline',
    size: 'sm',
  });
}

API

UiButton

InputTypeDefaultDescription
variant'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'glass' | 'glass-prominent' | 'glass-clear''default'Visual style.
size'default' | 'sm' | 'lg' | 'icon' | 'icon-circle''default'Height and padding: 48, 36 and 56px. icon is a square, icon-circle a circle.
disabledbooleanfalseDims the button and ignores taps.
loadingbooleanfalseShows a spinner before the label, dims the button, ignores taps.
accessibility-labelstring—What a screen reader says. Needed for an icon-only button.
classstring''Extra Tailwind classes for the container.
OutputTypeDescription
pressedvoidEmits on tap, unless disabled or loading.

The file also exports buttonVariants and the ButtonVariant, SolidButtonVariant, GlassButtonVariant and ButtonSize types.

Accessibility

  • A screen reader reads the label as a button. With accessibility-label, the whole button is one element that says the label instead.
  • Reduce Motion: the button dims while pressed instead of shrinking. Interactive glass in the web preview stops swelling. iOS calms its own glass.
  • Reduce Transparency and Increase Contrast: the glass follows them as Glass does. Clear glass that turns solid drops its dimming layer and its white label. Under Increase Contrast, Android's tonal buttons get an outline.