Introduction
The<Text>
component is used to render text in your data app. It lets you easily display and customize your text content.
Basic usage
To use the<Text>
component, you can just include it in your views and pass the text you want to display as a child of the component.
<h1>
tag.
These are the predefined styles available for the <Text>
component, along with their corresponding font size and line height:
Style | Settings |
---|---|
H1 | Font size 36px, Line height 48px |
H2 | Font size 26px, Line height 40px |
H3 | Font size 20px, Line height 32px |
H4 | Font size 16px, Line height 24px |
H5 | Font size 14px, Line height 20px |
H6 | Font size 12px, Line height 16px |
Advanced usage
Apart from the predefined styles, you can also customize the text using the following properties:Sets the color of the text. Options are:
primary
, secondary
, destructive
, accent
, background
, foreground
, link
, inherit
.Sets the size of the text. Options are:
h1
, h2
, h3
, h4
, h5
, h6
.Sets the font family of the text. Options are:
sans
, mono
.Sets the font weight of the text. Options are:
normal
, medium
, semibold
, bold
.Sets the letter spacing of the text. Options are:
normal
, wide
.Sets the text alignment. Options are:
left
, center
, right
.Sets the word break behavior. Options are:
normal
, breakWord
, breakAll
.Sets the white space behavior. Options are:
normal
, nowrap
, pre
, preLine
, preWrap
.Custom styles
If you want to further customize the text, you can use theclass
property to pass your own styles using Tailwind. Here’s an example: