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
Manual
- Install the dependencies:
-
Add the pieces it builds on: the primitives
components/primitives/types.tsx,components/primitives/use-render.tsx. -
Copy the source into
components/ui/text.tsx:
- Update the import paths to match your project.
- Install the dependencies:
-
Add the pieces it builds on: the primitives
components/primitives/types.tsx,components/primitives/use-render.tsx. -
Copy the source into
components/ui/text.tsx:
- Update the import paths to match your project.
-
Add the pieces it builds on: the primitives
components/primitives/types.tsx,components/primitives/use-render.tsx. -
Copy the source into
components/ui/text.tsx:
- Update the import paths to match your project.
-
Target iOS 17 or later.
-
Copy the theme files every view uses:
- Copy the source:
- Add the files to your app target.
- Set
minSdkto 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
Pick a variant for the role of the text, and add classes through className for one-off changes.
Use the render prop to render a different component with the same classes. TextClassContext is exported so your own components can style nested Text the same way.
Examples
Typography
Every variant in a sample article.

Headings
The four heading levels.

API Reference
Text
The text element with typography variants.
| Prop | Type | Default | Description |
|---|---|---|---|
render | RenderProp<Record<string, unknown>, Record<string, never>> | - | Renders another component in place of the default Text, with the same props. |
variant | "default" | "h1" | "h2" | "h3" | "h4" | "p" | "blockquote" | "code" | "lead" | "large" | "small" | "muted" | "default" | Typography style. |
Also accepts the props of React.ComponentProps<typeof RNText>, React.RefAttributes<typeof RNText>, TextVariantProps.
Accessibility
h1toh4setrole="heading", so VoiceOver and TalkBack can navigate by heading.- Text scales with the system font size.
Notes
- Colors use the
text-foregroundandtext-muted-foregroundtokens;codeusesbg-mutedandblockquoteaborder-borderstart border. - Light and dark colors follow the system appearance.


