suiss/ui · Component
Text
Styled text with typography variants for headings, body copy, quotes, code and captions.
Text is an open-source component from suiss/ui for React Native, SwiftUI and Jetpack Compose. The @esuiss/ui CLI copies its source into your project, so you own the code.

Text renders a React Native Text with one of twelve typography variants: default, h1–h4, p, blockquote, code, lead, large, small and muted. Heading variants also set the heading role.
It reads TextClassContext, so components such as Button can pass a text color and size down to any Text inside them.
Installation
- Install the following dependencies:
- Copy the primitives it uses into
components/primitives:
- Copy and paste the following code into
components/ui/text.tsx:
- Update the import paths to match your project setup.
- Install the following dependencies:
- Copy the primitives it uses into
components/primitives:
- Copy and paste the following code into
components/ui/text.tsx:
- Update the import paths to match your project setup.
- Copy the primitives it uses into
components/primitives:
- Copy and paste the following code into
components/ui/text.tsx:
- Update the import paths to match your project setup.
-
Target iOS 17 or later.
-
Copy the theme files every view uses:
- Copy the source:
- Add the files to your app target.
- Apply the Compose compiler plugin, enable Compose, set
compileSdkto 37 or higher andminSdkto 24 or higher, and add the dependencies:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Update the
com.esuiss.uipackage names to match your project.
Usage
Examples
Typography
Every variant in a sample article.

Headings
The four heading levels.

Accessibility
h1toh4setrole="heading", so VoiceOver and TalkBack can navigate by heading.- Text scales with the system font size.
API Reference
Text
The text element with typography variants.
| Prop | Type | Default |
|---|---|---|
render | RenderProp<Record<string, unknown>, Record<string, never>> | - |
variant | "default" | "h1" | "h2" | "h3" | "h4" | "p" | "blockquote" | "code" | "lead" | "large" | "small" | "muted" | "default" |
Also accepts the props of TextProps.
Pick a variant for the role of the text, and add classes through className for one-off changes. Use render to render another component in place of the default Text, with the same props and classes. TextClassContext is exported so your own components can style nested Text the same way.
TextVariant
Values: .default, .h1, .h2, .h3, .h4, .p, .blockquote, .code, .lead, .large, .small, .muted.
.textVariant
| Parameter | Type | Default |
|---|---|---|
_ variant | TextVariant: .default | .h1 | .h2 | .h3 | .h4 | .p | .blockquote | .code | .lead | .large | .small | .muted | - |
TextVariant
Values: Default, H1, H2, H3, H4, P, Blockquote, Code, Lead, Large, Small, Muted.
Text
The text element with typography variants.
| Parameter | Type | Default |
|---|---|---|
text | String | - |
modifier | Modifier | Modifier |
variant | TextVariant: Default | H1 | H2 | H3 | H4 | P | Blockquote | Code | Lead | Large | Small | Muted | TextVariant.Default |
color | Color | Color.Unspecified |
textAlign | TextAlign | TextAlign.Unspecified |
overflow | TextOverflow | TextOverflow.Clip |
softWrap | Boolean | true |
maxLines | Int | Int.MAX_VALUE |
minLines | Int | 1 |
style | TextStyle | TextStyle.Default |


