Text
Preview: Tones
Text primitive with consistent sizes, weights and tones.
Import
import { Text } from '@marbleui/ui'Props
<Text>
| Prop | Type | Default | Description |
|---|---|---|---|
| as | 'div' | 'small' | 'span' | 'label' | 'em' | 'p' | 'strong' | 'p' | |
| size | 'xs' | 'sm' | 'md' | 'lg' | 'sm' | |
| tabular | boolean | — | |
| tone | 'default' | 'accent' | 'success' | 'danger' | 'muted' | 'subtle' | 'default' | |
| truncate | boolean | — | |
| weight | 'medium' | 'normal' | 'semibold' | 'normal' |
Also accepts HTML element props (278).
Usage notes
Text primitive for consistent size, tone and weight. For headings use Heading; for long-form HTML or Markdown use Prose.
<Text tone="muted">Secondary text</Text>
<Text as="span" size="xs" tone="danger" weight="medium">Something went wrong</Text>
asisp(default),span,div,label,small,strongorem.sizeisxs,sm(default),mdorlg;toneisdefault,muted,subtle,accent,dangerorsuccess;weightisnormal,mediumorsemibold.truncateclips to one line with an ellipsis (the element needs a constrained width);tabularuses tabular numerals for aligned figures.- Check contrast when using
subtlefor text that matters.
Example source · show· hide
import { Text } from './text'
export const styles = {
Tones: () => (
<div className="flex flex-col gap-1">
<Text>Default body text</Text>
<Text tone="muted">Muted secondary text</Text>
<Text tone="subtle" size="xs">Subtle helper text</Text>
<Text tone="accent" weight="medium">Accent emphasis</Text>
<Text tone="danger" size="xs">Something went wrong</Text>
</div>
),
Sizes: () => (
<div className="flex max-w-sm flex-col gap-2">
<Text size="lg">Large lead paragraph for introductions and marketing copy.</Text>
<Text size="md">Medium body for long-form reading.</Text>
<Text size="sm" tone="muted">Small UI text for dense interfaces.</Text>
<Text as="span" tabular weight="semibold">$1,204,330.00</Text>
</div>
),
}Source: packages/ui/src/text/text.tsx
Catalog
- Category
- typography
- Priority
- Core
- Primitive
- custom
- React Aria
- Text