Skip to main content

Typography

Theme-aware text component with i18n support, text decoration, alignment, and loading states.

Basic Usage

import { Typography } from '@multinaire/ui';

<Typography>Hello World</Typography>

<Typography type="heading" weight="bold" color="primary">
Styled Text
</Typography>

Props

PropTypeDefaultDescription
typeStyleKeys'body'Text style preset. Options: 'display', 'heading', 'subheading', 'title', 'body', 'caption'
weightTextKeys'regular'Font weight. Options: 'regular', 'medium', 'bold'
colorColorKeys'onBackground'Text color key from the active theme palette
alignmentTextStyle['textAlign']Text alignment. Equivalent to textAlign property
decorationTextStyle['textDecorationLine']Text decoration line. Equivalent to textDecorationLine property
transformTextStyle['textTransform']Text transform. Equivalent to textTransform property
centerbooleanfalse⚠️ Deprecated. Use alignment="center" instead
marginSpacingPropsOuter margin. Accepts a number for uniform margin, or an object for per-side control
flexnumberFlex grow value
isLoadingbooleanfalseShow a loading skeleton in place of the text
textWidthnumber200Width of the loading skeleton in pixels
translatebooleantrueWhen true, string children are passed through the i18n translation function. Defaults to true

All standard React Native TextProps are also supported and forwarded.

Examples

Text Styles

<Typography type="heading">Heading</Typography>
<Typography type="subheading">Subheading</Typography>
<Typography type="body">Body text</Typography>
<Typography type="caption">Caption</Typography>

Font Weights

<Typography weight="regular">Regular</Typography>
<Typography weight="medium">Medium</Typography>
<Typography weight="bold">Bold</Typography>

Colors

<Typography color="primary">Primary</Typography>
<Typography color="secondary">Secondary</Typography>
<Typography color="error">Error</Typography>

Text Alignment

<Typography alignment="center">Centered text</Typography>
<Typography alignment="right">Right-aligned text</Typography>
<Typography alignment="justify">Justified text</Typography>

Text Decoration

<Typography decoration="underline">Underlined text</Typography>
<Typography decoration="line-through">Strikethrough text</Typography>
<Typography decoration="underline line-through">Both</Typography>

Text Transform

<Typography transform="uppercase">UPPERCASE TEXT</Typography>
<Typography transform="lowercase">lowercase text</Typography>
<Typography transform="capitalize">Capitalized Text</Typography>

Loading State

<Typography isLoading textWidth={150}>
This text is loading
</Typography>

With Translation

// Automatically translates using i18next
<Typography>welcome_message</Typography>

// Disable translation
<Typography translate={false}>Literal text</Typography>

Migration

The center prop is deprecated. Replace it with alignment="center":

// Before
<Typography center>Centered text</Typography>

// After
<Typography alignment="center">Centered text</Typography>