Text | UI components (BETA)
APPLICABLE PRODUCTS
-
Sales Hub
- Enterprise
-
Service Hub
- Enterprise
The Text
component renders text with formatting options.
Prop | Type | Description |
---|---|---|
format |
Object | Text formatting options, which include:
See the variants section for more information. |
variant |
'bodytext' (default) | 'microcopy' |
The style of text to display. See the variants section for more information. |
inline |
Boolean | When set to true , will insert text without breaking the line. Default is false . |
truncate |
Boolean | object |
Truncates long strings to a single line. If the full string doesn't fit on one line, the excess text will display in a tooltip on hover.
Alternatively, set this prop to one of the following objects to specify truncate options:
|
Using the format
prop, you can style text with a number of options:
{fontWeight: 'bold'}
: sets the text to bold.{fontWeight: 'demibold'}
: sets the text to a lighter bold.{italic: true}
: sets the text to italics.{lineDecoration: 'strikethrough'}
: adds a strikethrough to the text.{lineDecoration: 'underline'}
: underlines the text.<Text inline={true}>
: enables you to set text styling within the same line by adding more text without breaking the line if possible. Line will still break when text content would extend past the boundaries of its container. For example:<Text>Text <Text inline={true} format={{fontWeight: 'bold'}}> with inner bold.</Text>
.
You can also control text size with the variant
prop.
variant="bodytext"
(default)variant="microcopy"
- DO: use text with clear messaging.
- DO: use text formatting thoughtfully. For example, don't bold all of the text that can be seen. Instead, only bold key words and phrases for easier scanning.
- DON'T: use the text component for the primary textual information on a card. Instead, consider using the Heading component.
- DON'T: use underline formatting for text that's next to a hyperlink, as it will also look clickable.
- DON'T: use microcopy for important or critical information. Instead, consider whether an Alert component would fit better.
- DON'T: use text components in place of headers, alerts, and errors.
Thank you for your feedback, it means a lot to us.
This form is used for documentation feedback only. Learn how to get help with HubSpot.