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

Typography

Nine text styles, from page headings to muted captions, that render as a single <text> element.

Installation

npx @blotch/dolan add typography
import { UiText } from '../components/ui/typography';

Typography imports class-variance-authority (see Installation).

Usage

src/app/app.ts
import { Component } from '@angular/core';
import { UiText } from '../components/ui/typography';

@Component({
  selector: 'app-root',
  imports: [UiText],
  template: `
    <ui-text variant="h1">Order history</ui-text>
    <ui-text variant="muted">Updated a minute ago</ui-text>
  `,
})
export class App {}

<ui-text> wraps its content in a <text> element and sets the color for you, so the text follows your theme.

Variants

VariantClassesUse for
h1text-4xl font-bold text-foregroundThe page title
h2text-3xl font-semibold text-foregroundSection titles
h3text-2xl font-semibold text-foregroundSubsection titles
h4text-xl font-semibold text-foregroundSmall headings
ptext-base text-foregroundBody text (the default)
leadtext-xl text-muted-foregroundAn intro paragraph
largetext-lg font-semibold text-foregroundEmphasized text
smalltext-sm font-medium text-foregroundLabels and fine print
mutedtext-sm text-muted-foregroundCaptions and hints

Custom classes

<ui-text variant="p" class="text-primary">Primary text</ui-text>
<ui-text variant="small" class="font-bold text-destructive">
  Payment failed
</ui-text>

Your classes replace the variant's classes where they conflict, so text-primary wins over text-foreground.

Line limit

<ui-text variant="small" [maxLines]="2">{{ notification.title }}</ui-text>

maxLines stops the text after that many lines and ends the last one with "…". It sets Lynx's text-maxline attribute and the text-ellipsis class together: text-maxline alone only sizes the box, so Android draws the lines past it over whatever follows, and iOS cuts them off with no "…". Without maxLines, the text takes every line it needs.

API

UiText

InputTypeDefaultDescription
variant'h1' | 'h2' | 'h3' | 'h4' | 'p' | 'lead' | 'large' | 'small' | 'muted''p'The text style.
maxLinesnumber | undefinedundefinedThe most lines the text takes, ending the last with "…".
classstring''Extra Tailwind classes for the text.

No outputs.

The file also exports typographyVariants and the TypographyVariant type.