Text

Text and headings in the type, sizes and colors of Plex UI.

import { Heading, Text } from "@plexui/react-native"

The scale and the colors are those of Typography.

Examples

Overview

Platform text styles

VariantiOSAndroid
largeTitle34/41Headline Large 32/40
title128/34Headline Medium 28/36
title222/28Headline Small 24/32
title320/25A dialog's and a sheet's title, 20/24 medium
headline17/22 semiboldTitle Medium 16/24 medium
body17/22Body Large 16/24
callout16/21Body Large 16/24
subheadline15/20Body Medium 14/20
footnote13/18A secondary line, 13/16
caption112/16Label Medium 12/16 medium
caption211/13Label Small 11/16 medium

Plex UI scale

Tabular figures

Platforms

iOS 26Android
Native componentText styles (Dynamic Type)Type scale
LookApple's eleven styles, Large Title 34/41 to Caption 2 11/13; secondary and tertiary text the label at 50% and 25%Material 3 roles, Headline Large 32/40 to Label Small 11/16, with sizes of its own for some text (Medium 20 for a dialog's or a sheet's title, 13 for a secondary line); secondary and tertiary text in grays, the ink at 50% and 35%

variant keeps Apple's names on both platforms: on Android each one takes the nearest Material role, or a size of its own for title3 and footnote, as the table under Platform text styles lists.

API

Text

PropTypeDefaultDescription
variant"largeTitle" | "title1" | "title2" | "title3" | "headline" | "body" | "callout" | "subheadline" | "footnote" | "caption1" | "caption2""body"A text style of the platform: Apple's sizes on iOS, the nearest Material 3 role on Android (sizes of its own for title3 and footnote)
size"3xs" | "2xs" | "xs" | "sm" | "md" | "lg"—A size of the Plex UI text scale in place of the platform style
weight"regular" | "medium" | "semibold" | "bold"—Font weight; defaults to the style's (regular with a size). A Text inside another with neither variant nor size takes its parent's size, line and color and changes only its weight, as a name in a line; a control among the words keeps its own text
color"primary" | "secondary" | "tertiary" | "disabled" | "inverse" | "accent" | "danger" | "success" | "warning" | "caution" | "info" | "discovery" | string"primary"A semantic color or any color string. Inside a control the text takes the control's color unless it sets its own
alignTextStyle["textAlign"]—Text alignment
monobooleanfalseThe monospace face of the kit
tabularNumsbooleanfalseFigures of one width, for counters and prices
childrenReactNode—The text
styleStyleProp<TextStyle>—Style of the text; all of React Native Text's props pass through

Heading

PropTypeDefaultDescription
size"xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl""md"A size of the Plex UI heading scale
weight"regular" | "medium" | "semibold" | "bold""semibold"Font weight
colorTextColor | string"primary"A semantic color or any color string
alignTextStyle["textAlign"]—Text alignment
monobooleanfalseThe monospace face of the kit
tabularNumsbooleanfalseFigures of one width
childrenReactNode—The heading, announced as a header
styleStyleProp<TextStyle>—Style of the heading; all of React Native Text's props pass through

Cap inset

useTheme().capInset({ fontSize, lineHeight, fontFamily }) says how far under the top of its line box a line's capitals start: half the line's leading over the face, and the face's room over its capitals (17/22 in SF Pro, about 5). A gap a design measures to the capitals of a title takes it off, so the room runs to what shows: a page control under a photo stands as far from the photo as from the title under it. The face is the theme's sans face, or fontFamily. A brand's own face says its metrics with --font-metrics-<family> (the family in lower case, a hyphen for anything but a letter or a figure), its ascent, descent and cap height in em. Otherwise, in a browser, the face the page draws the family in is measured: its CSS variables as the page sets them, its fallbacks, the host's system face. On a phone the face's tables count (SF Pro on iOS, Roboto on Android, Inter), and on iOS a line shorter than its face stands at its foot, as React Native sets it.

const theme = useTheme()
// 16 from the page control to the title's capitals, not to its line box
const gap = 16 - theme.capInset({ fontSize: 17, lineHeight: 22 })

// A brand's display face
<ThemeProvider brand={{ tokens: { "--font-metrics-brand-display": "0.93 0.24 0.7" } }}>

useTheme().capHeight({ fontSize, fontFamily }) and useTheme().xHeight({ fontSize, fontFamily }) give the face's cap height and x-height in points, by the same metrics (SF Pro 13: about 9.2 and 6.8). Words in lower case have no capitals to center by: their x-height's middle stands on the center when they rise by half the difference, as Badge's textCase="lowercase" sets them. A brand gives its face's x-height as a fourth number in --font-metrics-<family>, in em; without it the x-height is three quarters of the cap height.

const theme = useTheme()
// A lower-case word centered by its x-height in a box centered by capitals
const rise = (theme.capHeight({ fontSize: 13 }) - theme.xHeight({ fontSize: 13 })) / 2