Text (code)
The Text component is a very generic component that support a wide range of text styles.
Props
System Props
System Props
Next to the properties listed in the propstable, a collection of system props can be added to any component for further general styling and layouting purposes. These props vary per component.
To read more about the system, click here to check out its dedicated page.
Related components
While this component is meant for ultimate flexibility when it comes to text-related requirements, there are also other text-related predefined components.
These are:
The reason these separate components also exist, is purely for developer experience. The above components can be constructed by combining the necessary parameters on the component (internally, the above components are an extension of the component). However, they have default behaviour built in, e.g. the component will automatically add a bold and will change its HTML element based in the , etc.
Size
The size property corresponds to all the possible sizes defined in the typography foundations.
The default here is . This size is the best default to fall back to, since it has an average font-size and corresponding line-height. The difference with is not the font-size, but rather the line-height. size has a line-height that is 1.5 times the font-size, which improves readability in paragraphs of text, but is not suited as a default size.
NOTE: The size does not translate to a certain HTML element. If you want to customize the HTML element, use the prop as well.
FontFamily
Font-families can be used to discern between multiple uses.
TextTransform
TextAlign
Controls the css text-align attribute.
FontWeight
Controls the font-weight css attribute. Only 3 values are available. If a value is missing, it will fallback on the more bold weight.
Decoration
Controls the text-decoration css attribute.