Skip to content

Text

Every string in a Stratum UI should render through the Text atom rather than React Native’s bare <Text>, so typography always flows through the active theme. Three variants cover the standard mobile type roles.

When to use: Any non-heading text — body copy, metadata, form labels, navigation items, captions.

When not to use: Screen titles and section headers (use Heading).

import { Text } from '@/components';
<Text variant="body" size="md">Main content paragraph.</Text>
<Text variant="caption" color="muted">Posted 3 hours ago</Text>
<Text variant="label" weight="semibold" color="accent">See all</Text>
PropTypeDefaultDescription
variant'body' | 'caption' | 'label''body'Semantic text role
size'xs' | 'sm' | 'md' | 'lg'Variant defaultOverride the variant’s size
weight'regular' | 'medium' | 'semibold' | 'bold'Variant defaultOverride the variant’s weight
color'primary' | 'secondary' | 'muted' | 'accent' | 'inverse' | 'onAccent''primary'Semantic color slot
childrenReactNodeText content (required)
numberOfLinesnumberTruncate after N lines
styleStyleProp<TextStyle>Additional styles (use sparingly)
testIDstringFor testing
VariantDefault sizeDefault weightTypical use
bodymd (15px)regularReading copy, descriptions
captionxs (11px)regularTimestamps, metadata, secondary lines
labelsm (13px)mediumForm labels, nav items, UI controls
// Body — paragraph text, descriptions
<Text variant="body">Your invoice has been sent to alice@example.com.</Text>
// Caption — timestamps, secondary info, fine print
<Text variant="caption" color="muted">Last updated · 2 hours ago</Text>
// Label — UI control labels, form fields, navigation
<Text variant="label">Email address</Text>
<Text variant="label" weight="semibold" color="accent">View details ›</Text>
<Text color="primary">Default text color</Text>
<Text color="secondary">Supporting text (slightly dimmed)</Text>
<Text color="muted">Placeholder, timestamps, fine print</Text>
<Text color="accent">Links, CTAs, highlights</Text>
<Text color="inverse">Text on dark surfaces</Text>
<Text color="onAccent">Text inside accent-colored containers</Text>

Do: Use semantic color names — they update automatically across themes and light/dark modes.

<Text color="muted">Posted 3 hours ago</Text>

Don’t: Use style for color — it bypasses the theme.

// ✗
<Text style={{ color: '#999' }}>Posted 3 hours ago</Text>

Don’t: Use Text for screen or section titles — use Heading.

// ✗
<Text variant="body" weight="bold" size="lg">My Account</Text>
// ✓
<Heading level={2}>My Account</Heading>
  • Heading — screen titles and section headers
  • Icon — often paired with Text in list rows