Skip to main content

Typography

Typography renders text using the Material Design 3 type scale.

Usage

import { Typography } from '@onlynative/components/typography'

<Typography variant="headlineMedium">Hello World</Typography>
<Typography variant="bodyLarge">Body text content.</Typography>

Variants

The full MD3 type scale:

CategoryVariants
DisplaydisplayLarge, displayMedium, displaySmall
HeadlineheadlineLarge, headlineMedium, headlineSmall
TitletitleLarge, titleMedium, titleSmall
BodybodyLarge, bodyMedium, bodySmall
LabellabelLarge, labelMedium, labelSmall

Accessibility

Display and headline variants automatically receive accessibilityRole="header" for screen readers.

Custom Styles

<Typography variant="bodyMedium" style={{ color: 'red' }}>
Custom colored text
</Typography>

Custom Text Component

Use the as prop to render with a custom text component:

import { Animated } from 'react-native'

<Typography variant="titleLarge" as={Animated.Text}>
Animated text
</Typography>

Props

No props found for Typography.