Text

RSC
A text component that supports paragraphs and various formatting options.
Installation
API Reference
Important Note
This is the documentation for gluestack-ui v2 (beta). For @gluestack-ui/themed (stable) documentation, refer to gluestack-ui v1.
This is an illustration of Text component.
<Text>Hello World!</Text>

Installation

Run the following command:

npx gluestack-ui add text

API Reference

To use this component in your project, include the following import statement in your file.
import { Text } from "@/components/ui/text"
export default () => <Text />

Component Props

This section provides a comprehensive reference list for the component props, detailing descriptions, properties, types, and default behavior for easy project integration.

Text

It inherits all the properties of React Native's Text component.

Props

Text component is created using Text component from react-native. It extends all the props supported by React Native Text, utility props and the props mentioned below.

Text

Name
Value
Default
isTruncated
true
false
bold
true
false
underline
true
false
strikeThrough
true
false
sub
true
false
italic
true
false
highlight
true
false
size
2xs | xs | sm | md | lg | xl | 2xl | 3xl | 4xl | 5xl | 6xl
md

Examples

The Examples section provides visual representations of the different variants of the component, allowing you to quickly and easily determine which one best fits your needs. Simply copy the code and integrate it into your project.

Text Sizes

Text component comes in different sizes, such as xs, sm, md, lg, xl, 2xl, 3xl, 4xl, 5xl, and 6xl allowing users to adjust the button size based on their design needs.
function App() {
const sizes = [
"xs",
"sm",
"md",
"lg",
"xl",
"2xl",
"3xl",
"4xl",
"5xl",
"6xl",
]
return (
<Center>
{sizes.map((size) => (
<Text size={size} className="text-center">
{size}
</Text>
))}
</Center>
)
}
Text component also accepts some shorthands for basic quick styling.
Prop
Type
Default
Description
bold
boolean
false
Used to make the text bold.
isTruncated
boolean
false
If true, it will render an ellipsis when the text exceeds the width of the viewport or maxWidth set.
italic
boolean
false
Used to make the text italic.
underline
boolean
false
Used underline the text.
strikeThrough
boolean
false
A horizontal line through the center of the text.
highlight
boolean
false
Used to highlight the text with a yellow background.