Text
Text is the used to render text and paragraphs within an interface. It renders a
<p>
tag by default.
Import
Changing the font size
To increase the font size of the text, you can pass the fontSize
prop.
Editable Example
In love with React & Next
In love with React & Next
In love with React & Next
In love with React & Next
In love with React & Next
In love with React & Next
In love with React & Next
In love with React & Next
In love with React & Next
In love with React & Next
Truncate text
Pass the isTruncated
prop to render an ellipsis when the text exceeds the
width of the viewport or maxWidth
set.
Editable Example
Lorem ipsum is placeholder text commonly used in the graphic, print, and publishing industries for previewing layouts and visual mockups.
Multiline truncation is also supported. Simple pass a number between 2
and 5
rather than a boolean.
Editable Example
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed hendrerit vel risus sit amet facilisis. Duis eleifend gravida lacus vel vestibulum. Aenean ex nunc, facilisis sit amet lorem sollicitudin, dictum lacinia metus. Vivamus lacus mauris, tempor id leo et, pretium dignissim massa. Aliquam erat volutpat. Vestibulum erat ligula, maximus a orci cursus, luctus rutrum justo. Aenean elementum mattis orci nec aliquet. Pellentesque malesuada aliquam lorem, a fermentum mi dictum sed. Integer ultricies dolor quis ex scelerisque, vitae pretium dolor consectetur. Integer fringilla justo sed venenatis luctus. Ut a sapien vitae lorem dignissim fringilla. Suspendisse sit amet leo quam.
Override style
You can change the entire style of the text via props. For example, to change
the font size, pass the fontSize
prop.
Editable Example
I'm using a custom font-size value for this text
Override the element
To override the element that gets rendered, pass the as
prop. Use Inspect
Element to see the element that gets rendered in html.
Editable Example
Underline
I18N
Citation
Emphasis
Inserted
⌘ + C
Highlighted
Sample
Code
sub
sup
Props
Text composes the Box component, so you can pass all Box
style props.
Name | Type | Default | Description |
---|---|---|---|
as | p , small , h1 , h2 , h3 , h4 , h5 , h6 , figcaption , pre , code , em , i , u , cite , del , ins , kbd , mark , s , samp , sub , sup , strong | p | The element to render for the text. |
truncate | boolean , 2 , 3 , 4 , 5 | false | Whether to truncate the text. Numeric values are used for line clamping. |