Examples

Type scale

Preview

Quarterly review

Revenue grew on enterprise renewals.

Expansion revenue offset seasonal churn.

Body text uses the md size: 14 px with a 1.5 line height.

Last updated 2 hours ago

Figures are unaudited.

Example.tsx
import { Stack, Text } from '@reactloom/ui';

export default function Example() {
  return (
    <Stack gap="1" style={{ width: '100%' }}>
      <Text size="3xl" weight="semibold">Quarterly review</Text>
      <Text size="xl">Revenue grew on enterprise renewals.</Text>
      <Text size="lg">Expansion revenue offset seasonal churn.</Text>
      <Text>Body text uses the md size: 14 px with a 1.5 line height.</Text>
      <Text size="sm" tone="muted">Last updated 2 hours ago</Text>
      <Text size="xs" tone="subtle">Figures are unaudited.</Text>
    </Stack>
  );
}

Tones

Every tone meets 4.5:1 on surfaces in the built-in themes.

Preview

Default — primary content

Muted — secondary information

Accent — highlighted value

Success — payment received

Warning — trial ends in 3 days

Danger — card declined

Example.tsx
import { Stack, Text } from '@reactloom/ui';

export default function Example() {
  return (
    <Stack gap="1">
      <Text>Default — primary content</Text>
      <Text tone="muted">Muted — secondary information</Text>
      <Text tone="accent">Accent — highlighted value</Text>
      <Text tone="success">Success — payment received</Text>
      <Text tone="warning">Warning — trial ends in 3 days</Text>
      <Text tone="danger">Danger — card declined</Text>
    </Stack>
  );
}

Truncation

The full text stays available to assistive technology.

Preview

Acme Corporation International Holdings — Enterprise subscription

Line clamping keeps the full text in the DOM, so screen readers read all of it while sighted users see two lines and an ellipsis.

Example.tsx
import { Stack, Text } from '@reactloom/ui';

export default function Example() {
  return (
    <Stack gap="4" style={{ width: '100%', maxWidth: 300 }}>
      <Text truncate>Acme Corporation International Holdings — Enterprise subscription</Text>
      <Text truncate={2} tone="muted">
        Line clamping keeps the full text in the DOM, so screen readers read all of it while sighted users see two
        lines and an ellipsis.
      </Text>
    </Stack>
  );
}

API reference

Text props
PropTypeDefault
as
'p' | 'span' | 'div' | 'label' | 'strong' | 'em' | 'small' | …'p'
size
'xs' … '5xl''md'
weight
'regular' | 'medium' | 'semibold' | 'bold'—
tone
'default' | 'muted' | 'subtle' | 'accent' | 'danger' | 'success' | 'warning'—
align
'start' | 'center' | 'end'—
truncate
One line, or clamp to N lines.
boolean | number—
mono · tabularNums
booleanfalse

Customization

Extracted from the component’s source on every build, so it matches the code. How the layers fit together is explained in Customization.

State attributes

Target these in your CSS to style states without depending on class names.

AttributeValues
[data-align]start · center · end
[data-mono]present when on
[data-size]xs · sm · md · lg · xl · 2xl · 3xl · 4xl · 5xl
[data-tabular]present when on
[data-tone]default · muted · subtle · accent · danger · success · warning
[data-weight]regular · medium · semibold · bold

Theme tokens it reads

--pl-color-accent-fg --pl-color-danger-fg --pl-color-fg-default --pl-color-fg-muted --pl-color-fg-subtle --pl-color-success-fg --pl-color-warning-fg --pl-font-size-2xl --pl-font-size-3xl --pl-font-size-4xl --pl-font-size-5xl --pl-font-size-lg --pl-font-size-md --pl-font-size-sm --pl-font-size-xl --pl-font-size-xs

Accessibility

  • Colour is never the only signal — pair tones with words or icons.

Usage guidelines

Do

  • Use tabularNums for figures in tables.

Don’t

  • Don’t use Text for headings — use Heading.