Skip to main content

MultinaireText

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

Basic Usage

import { MultinaireText } from '@multinaire/multinaire-design';

<MultinaireText>Hello World</MultinaireText>

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

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

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

Font Weights

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

Colors

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

Text Alignment

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

Text Decoration

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

Text Transform

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

Loading State

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

With Translation

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

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

Migration

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

// Before
<MultinaireText center>Centered text</MultinaireText>

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