import { Text } from '@uhg-abyss/web/ui/Text';() => { return ( <Text color="$web.semantic.color.text.content.secondary" fontSize="md" fontWeight="regular" > Lorem ipsum dolor sit amet. </Text> );};Color
Use the color prop to set the color of the text. This prop accepts any valid CSS color identifier (RGB, HSL, named color, etc.) as well as Abyss color tokens. The default value is '$web.semantic.color.text.content.secondary'.
Text colors must meet the minimum 4.5:1 contrast ratio for normal text and 3:1 for large text as per WCAG 2.1 guidelines.
Font size
Use the fontSize prop to change the size of the text. The available options are 'lg', 'md', 'sm', and 'xs'. The default value is 'md'.
Font weight
Use the fontWeight prop to change the weight of the text. The available options are 'bold', 'medium', and 'regular'. The default value is 'regular'.
Polymorphic component
The Text component is polymorphic, meaning that the underlying HTML element can be changed using the asElement prop. By default, the component renders as a <span>.
Text Props
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
asElement | string | undefined | 'span' | - | The HTML element to use for the text |
children | React.ReactNode | - | The text content to display | |
color | React.CSSProperties['color'] | undefined | '$web.semantic.color.text.content.secondary' | - | The color of the text |
fontSize | 'lg' | 'md' | 'sm' | 'xs' | undefined | 'md' | - | The font size of the text |
fontWeight | 'bold' | 'medium' | 'regular' | undefined | 'regular' | - | The font weight of the text |
Text Classes
| Class Name | Description |
|---|---|
| .abyss-text-root | The text root |