The Text component should be used for all text on the page.
Props
Variants
Alignment
Use this to adjust the positioning of text within wrapper elements.
Block vs. inline
The Text component allows you to specify whether you want block or inline text.
Colors
You can specify which color you want for your text. Most colors change in dark mode, but light and dark are available when no switch is desired.
⚠️ Note that the previous options ('red', 'white', 'lightGray', 'gray', 'darkGray', 'green', 'pine', 'olive', 'blue', 'navy', 'midnight', 'purple', 'orchid', 'eggplant', 'maroon', 'watermelon', 'orange') are still valid but will be deprecated soon.
Overflow
Gestalt provides utility options to deal with text overflow.
Sizes
You can apply size options to define the size of the text. These font sizes follow those available through our Design Tokens. If your text needs to be a semantic heading (H1-H6), use Heading instead.
Styles
There are multiple styles, such as bold and italic, that we can attach to the Text component.
Title
The title attribute on a <div> can be used to show the full text of a truncated string on hover. That attribute is populated automatically when the text is truncated using lineClamp, as long as children is a string.
If children is a React.Node (e.g. when using Link), use the title prop to manually set the title attribute.