React
Is new design vision part implemented using new tokens?
React
Is new design vision part implemented using new tokens?
Use this component for consistent rendering of texts, using the text presets available.
Use Typography component in every case you need to render text, from paragraphs to titles.
In case the needed preset is not available, please discuss it with Design team and contribute if needed.
Name |
Description |
Type |
Default |
---|---|---|---|
textStyle |
Defines which set of CSS rules will apply to the text |
TextStyle |
- |
as |
Defines which element will be render ultimately in the DOM |
React.ElementType |
- |
children |
Gives the button a specific data test id |
React.ReactNode |
- |
align? |
Aligns the content |
'left' | 'right' | 'center' |
undefined |
noWrap? |
Prevents text from wrapping |
boolean |
undefined |
overflowWrap? |
Controls the overflow-wrap CSS property used for preventing text from overflowing. |
'normal' | 'break-word' |
undefined |
wordBreak? |
Controls the word-break CSS property used for preventing text from overflowing. |
'break-all' | 'break-word' | 'normal' |
undefined |
variant? |
Defines the color |
TypographyVariant |
primary |
ellipsis? |
Enables the text-overflow CSS property. |
boolean |
undefined |
maxLines? |
maxLines for the ellispis property |
number |
undefined |
Existing typography components are now using this one underneath, configured with the proper preset in each case, so they are up to date, valid and can be used.
Component |
Text style |
---|---|
MajorHighlight |
highlightMedium |
ModerateHighlight |
highlightSmall |
MinorHighlight |
bodyLargeStrong |
Label |
bodyMediumStrong |
SmallLabel |
bodySmallStrong |
Body |
size === 'small' ? 'bodyMedium' : 'bodyLarge' |
PageTitle |
titleLargeStrong |
SectionTitle |
titleMediumStrong |
SubsectionTitle |
titleSmallStrong |
This utility allows the use of any textStyle without needing to rely on one of the predefined components mentioned above.
Primarily, it is used within the Design System for styling components, but it can also be applied externally to style native HTML elements or React components in situations where the Design System does not provide a suitable solution.
This utility serves the same purpose as getTextTokenPreset but returning a JS object with the CSS properties: