Text

Looking to add text to your gluestack-ui project? Check out our text component, which supports paragraphs and other formatting options.
API Reference
Themed
Unstyled
This is an illustration of a Themed Text component with default configuration.
<Text>Hello World!</Text>

API Reference

Import

To use this component in your project, include the following import statement in your file.
import { Text } from "@gluestack-ui/themed"

Anatomy

The structure provided below can help you identify and understand a Text component's various parts.
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.

Themed

The themed version of the component is a pre-styled version of the component, which allows you to quickly integrate the component into your project. The component's design and functionality are fully defined, allowing you to focus on the more important aspects of your project. To know more about Themed Library please visit this link.

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
Note: These props are exclusively applicable when utilizing the default configuration of gluestack-ui/config. If you are using a custom theme, these props may not be available.

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}>{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.

Unstyled

All the components in gluestack-ui are unstyled by default. To customize your UI using the extendedTheme, please refer to this link. The import names of components serve as keys to customize each component.
Edit this page on GitHub