Skip to main content
Brand and assets
Build
Monitor and contribute
/
Component library
  • All components
  • Buttons & actions
  • Forms & inputs
  • Layout & containers
  • Overlays
  • Feedback & status
  • Data display
  • Typography
    • A
    • AnimatedTypography
    • Code
    • Em
    • FormattedText
    • Heading
    • Highlight
    • List
    • Paragraph
    • Strike
    • Strong
    • Text
  • Accessibility
  • Contrib
  • Deprecated
  • Typography
  • Text

Text

The base text component, carrying the theme's type styles. The default body size differs by platform.

Health
Component health
Source
View on Github
Design
View Figma
Playground
No Example
Accessibility

partially-compliant

Platform
Universal
Accessibility issues
the italic typography component is missing the `emphasis` role
  • Overview
  • Props
  • Figma

Usage​

Use Text component to display text with theme styles. Default body size by platform: mobile $text300, desktop (e.g. customer dashboard) $text200. See Typography — Default body size. Control Text styles with props:

I'm a text in size 200 on web and 300 on mobile 👋

Weight, size, color, align, italic​

Use the color prop only when it carries a semantic meaning (e.g. links, errors, status). For normal text and headings, prefer neutral (grey) and express hierarchy with size and weight. See Color and text in the foundations.

Size 100 text

Size 200 text (default on web)

Size 300 text (default on mobile)

Size 400 text

Size 500 text

Medium

Bold

Italic

Indigo 500 text

Red 500 text

Aligned to center

Aligned to right

Responsive size​

size also accepts one size per breakpoint, like Heading. Widths that no key matches keep the default or inherited size. Paragraph, Strike and List accept it too.

Resize the window

Styling​

You can add additional styles through the sx prop:

Underline and uppercase

Number of lines & ellipsis​

You can truncate the text and add ellipsis by specifying the maximum number of line you need.

warning

On web, adding this props will automatically change the display to block. You can have display issues.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

Accessibility​

On the web, you should always wrap text content in a meaningful semantic element like <p>, <a>, <h1>, etc.

To help you do so Text will automatically set the tag to p if ancestors tags are decorative only, span otherwise.

Note: It works only with components based on our universal TypographyBase component.

Playground​

Loading...

Migrating from TextDeprecated​

Before

Loading...

After

Loading...

size prop mapping​

Old ValueNew Value
size12$text100
size14$text200
size16$text300
size18$text400
size24$text500
tip
This component is universal, its usage is the same in murray and murray/mobile.

Text props

NameTypeDefault ValueDescriptionUsage count
align
9 possibilities"unset""left""right""end""start""auto""center""justify"undefined
aria-disabledbooleanundefined
aria-labelstringundefined
aria-levelnumberundefinedHeading level when paired with `role="heading"`.
asChild
5 possibilitiesboolean"web""except-style""except-style-web"undefined
classNamestringundefined
color
4 possibilitiesundefined`$${string}`Variable<any>OpaqueColorValue
Color prop accepts Tamagui color tokens, ColorTokens, or dynamic token strings. Examples: "$grey900", "$indigo500", "$white", or dynamically constructed tokens like `$${name}900`
dir"auto"Directionundefined
ellipsizeMode"head""middle""tail""clip"undefined
fontFamilyFontTokensundefined
htmlForstringundefined
idstringundefined
italicbooleanundefined
langLocaleOrLanguageundefined
maxFontSizeMultipliernumbernullundefined
numberOfLinesnumberundefined
onLayout((e: LayoutChangeEvent) => void)undefined
onTextLayout
2 possibilitiesundefined(e: NativeSyntheticEvent<TextLayoutEventData>) => void
Fires on mobile with the list of rendered lines. Passes through to the underlying RN Text.
roleRoleundefined
size
9 possibilitiesundefinednumberVariable<any>"$text100""$text200""$text300""$text400""$text500"Partial<Record<"$xs" | "$ltVs" | "$vs" | "$ltSm" | "$sm" | "$ltMd" | "$md" | "$ltLg" | "$lg" | "$ltXl" | "$xl" | "$ltXxl" | "$xxl", TextSize>>
Font size and line height token, see `TypographyBaseProps["size"]`. Also accepts one size per breakpoint, e.g. `{ $xs: "$text200", $lg: "$text300" }`: widths that no key matches keep the default or inherited size.
sx
2 possibilitiesundefinedOmit<TextProps, "fontStyle" | "fontFamily" | "fontWeight">
tabIndexstringnumberundefined
tag"p""span"undefined
transform
6 possibilities"none""capitalize""uppercase""lowercase""unset"undefined
weightTextWeightundefined

Undocumented props

NameTypeDefault ValueDescriptionUsage count
aria-hiddenany
aria-liveany
cssany
dangerouslySetInnerHTMLany
data-statusany
data-testidany
titleany

Style API​

Use sx for one-off adjustments. It accepts these style keys:

accessibilityActionsaccessibilityElementsHiddenaccessibilityHintaccessibilityIgnoresInvertColorsaccessibilityLabelaccessibilityLabelledByaccessibilityLanguageaccessibilityLargeContentTitleaccessibilityLiveRegionaccessibilityRespondsToUserInteractionaccessibilityRoleaccessibilityShowsLargeContentVieweraccessibilityStateaccessibilityValueaccessibilityViewIsModalaccessibleadjustsFontSizeToFitalignContentalignItemsalignSelfallowFontScalingandroid_hyphenationFrequencyanimateOnlyanimatePresenceanimationaria-busyaria-checkedaria-disabledaria-expandedaria-hiddenaria-labelaria-labelledbyaria-livearia-modalaria-selectedaria-valuemaxaria-valueminaria-valuenowaria-valuetextasChildaspectRatiobackdropFilterbackfaceVisibilitybackgroundbackgroundAttachmentbackgroundBlendModebackgroundClipbackgroundColorbackgroundImagebackgroundOriginbackgroundPositionbackgroundRepeatbackgroundSizeblockSizeborderBlockColorborderBlockEndColorborderBlockEndStyleborderBlockEndWidthborderBlockStartColorborderBlockStartStyleborderBlockStartWidthborderBlockStyleborderBlockWidthborderBottomColorborderBottomEndRadiusborderBottomLeftRadiusborderBottomRightRadiusborderBottomStartRadiusborderBottomWidthborderColorborderCurveborderEndColorborderEndEndRadiusborderEndStartRadiusborderEndWidthborderImageborderInlineColorborderInlineEndColorborderInlineEndStyleborderInlineEndWidthborderInlineStartColorborderInlineStartStyleborderInlineStartWidthborderInlineStyleborderInlineWidthborderLeftColorborderLeftWidthborderRadiusborderRightColorborderRightWidthborderStartColorborderStartEndRadiusborderStartStartRadiusborderStartWidthborderStyleborderTopColorborderTopEndRadiusborderTopLeftRadiusborderTopRightRadiusborderTopStartRadiusborderTopWidthborderWidthbottomboxShadowboxSizingcaretColorchildrenclassNameclipPathcolorcolumnGapcomponentNamecontaincontainerTypecontentcursordangerouslySetInnerHTMLdataDetectorTypedebugdirectiondisableClassNamedisableOptimizationdisableddisabledStyledisplaydynamicTypeRampelevationellipseellipsizeModeendenterStyleexitStyleexperimental_backgroundImageexperimental_backgroundPositionexperimental_backgroundRepeatexperimental_backgroundSizefilterflexflexBasisflexDirectionflexGrowflexShrinkflexWrapfloatfocusStylefocusVisibleStylefocusWithinStylefontSizefontVariantfontVariationSettingsforceStylegapgridColumngridColumnEndgridColumnGapgridColumnStartgridRowgridRowEndgridRowGapgridRowStartgridTemplateAreasgridTemplateColumnsgroupheighthitSlophoverStylehtmlForidimportantForAccessibilityincludeFontPaddinginlineSizeinsetinsetBlockinsetBlockEndinsetBlockStartinsetInlineinsetInlineEndinsetInlineStartisolationjustifyContentleftletterSpacinglineBreakModelineBreakStrategyIOSlineHeightmarginmarginBlockmarginBlockEndmarginBlockStartmarginBottommarginEndmarginHorizontalmarginInlinemarginInlineEndmarginInlineStartmarginLeftmarginRightmarginStartmarginTopmarginVerticalmaskmaskBordermaskBorderModemaskBorderOutsetmaskBorderRepeatmaskBorderSlicemaskBorderSourcemaskBorderWidthmaskClipmaskCompositemaskImagemaskModemaskOriginmaskPositionmaskRepeatmaskSizemaskTypematrixmaxBlockSizemaxFontSizeMultipliermaxHeightmaxInlineSizemaxWidthminBlockSizeminHeightminInlineSizeminWidthminimumFontScalemixBlendModenativeIDnumberOfLinesobjectFitonAccessibilityActiononAccessibilityEscapeonAccessibilityTaponBluronFocusonHoverInonHoverOutonLongPressonMagicTaponMouseDownonMouseEnteronMouseLeaveonMouseUponPressonPressInonPressOutopacityoutlineColoroutlineOffsetoutlineStyleoutlineWidthoverflowoverflowBlockoverflowInlinepaddingpaddingBlockpaddingBlockEndpaddingBlockStartpaddingBottompaddingEndpaddingHorizontalpaddingInlinepaddingInlineEndpaddingInlineStartpaddingLeftpaddingRightpaddingStartpaddingToppaddingVerticalpassThroughperspectivepointerEventspositionpressRetentionOffsetpressStylerightrolerotaterotateXrotateYrotateZrotationrowGapscalescaleXscaleYscreenReaderFocusablescrollbarWidthselectableselectionColorseparatorshadowColorshadowOffsetshadowOpacityshadowRadiusskewXskewYspacespaceDirectionstartstylesuppressHighlightingtabIndextagtargettestIDtextAligntextAlignVerticaltextBreakStrategytextDecorationColortextDecorationDistancetextDecorationLinetextDecorationStyletextEmphasistextOverflowtextShadowColortextShadowOffsettextShadowRadiustextTransformtextWrapthemethemeInversethemeShallowtoptouchActiontransformtransformMatrixtransformOrigintransformStyletransitiontranslateXtranslateYuntilMeasureduserSelectverticalAlignwhiteSpacewidthwordWrapwritingDirectionxyzIndex

Each can be overridden per breakpoint with:

$group-focus$group-focusVisible$group-focusWithin$group-hover$group-lg$group-lg-focus$group-lg-focusVisible$group-lg-focusWithin$group-lg-hover$group-lg-press$group-ltLg$group-ltLg-focus$group-ltLg-focusVisible$group-ltLg-focusWithin$group-ltLg-hover$group-ltLg-press$group-ltMd$group-ltMd-focus$group-ltMd-focusVisible$group-ltMd-focusWithin$group-ltMd-hover$group-ltMd-press$group-ltSm$group-ltSm-focus$group-ltSm-focusVisible$group-ltSm-focusWithin$group-ltSm-hover$group-ltSm-press$group-ltVs$group-ltVs-focus$group-ltVs-focusVisible$group-ltVs-focusWithin$group-ltVs-hover$group-ltVs-press$group-ltXl$group-ltXl-focus$group-ltXl-focusVisible$group-ltXl-focusWithin$group-ltXl-hover$group-ltXl-press$group-ltXxl$group-ltXxl-focus$group-ltXxl-focusVisible$group-ltXxl-focusWithin$group-ltXxl-hover$group-ltXxl-press$group-md$group-md-focus$group-md-focusVisible$group-md-focusWithin$group-md-hover$group-md-press$group-press$group-sm$group-sm-focus$group-sm-focusVisible$group-sm-focusWithin$group-sm-hover$group-sm-press$group-vs$group-vs-focus$group-vs-focusVisible$group-vs-focusWithin$group-vs-hover$group-vs-press$group-xl$group-xl-focus$group-xl-focusVisible$group-xl-focusWithin$group-xl-hover$group-xl-press$group-xs$group-xs-focus$group-xs-focusVisible$group-xs-focusWithin$group-xs-hover$group-xs-press$group-xxl$group-xxl-focus$group-xxl-focusVisible$group-xxl-focusWithin$group-xxl-hover$group-xxl-press$lg$ltLg$ltMd$ltSm$ltVs$ltXl$ltXxl$md$platform-android$platform-ios$platform-native$platform-web$sm$vs$xl$xs$xxl
Edit this page
Previous
Strong
Next
AccessibilityMenu
  • Usage
    • Weight, size, color, align, italic
    • Responsive size
    • Styling
    • Number of lines & ellipsis
  • Accessibility
  • Playground
  • Migrating from TextDeprecated
    • size prop mapping