Using Grommet for HPE?See Text examples and guidance.
Custom label to be used by screen readers. When provided, an aria-label will be added to the element.
string
"a user friendly label for screen readers"
How to align along the cross axis when contained in a Box or along the column axis when contained in a Grid.
string
"start"
"center"
"end"
"stretch"
"baseline"
The DOM tag or react component to use for the element.
string
The name of a component.
"div"
function
() => {}
A color identifier to use for the text color.
string
A hex, name, or rgb value.
"brand"
object
An object with a color for dark and light modes.
{ dark: "string", light: "string" }
The amount of margin around the component.
string
"none"
"xxsmall"
"xsmall"
"small"
"medium"
"large"
"xlarge"
object
An object can be specified to distinguish horizontal margin, vertical margin, and margin on a particular side. For vertical margin to be applied, Text needs to be contained within a layout component (such as Box or a generic div) or behave as a div (by applying as="div" or a display style of inline-block).
{ vertical: "...", horizontal: "...", top: "...", bottom: "...", left: "...", right: "..." }
The font size and line space height of the text.
string
"xsmall"
"small"
"medium"
"large"
"xlarge"
"xxlarge"
"2xl"
"3xl"
"4xl"
"5xl"
"6xl"
"string"
Any Skeleton properties which will be applied to the Text when in skeleton mode. For the Text to be in skeleton mode, use the 'skeleton' property on a parent Box.
object
{ width: { min: '200px' }}
The DOM tag to use for the element. NOTE: This is deprecated in favor of indicating the DOM tag via the 'as' property.
string
The name of a component.
"div"
function
() => {}
Tooltip or a hint when hovering over the text.
string
If the value is a string and no a11yTitle value is provided, tip value will be used for the a11yTitle default value.
"tooltip"
object
{ content: node | string, dropProps: {}, plain: boolean }
Restrict the text to a single line and truncate with ellipsis if it is too long to all fit. For truncate to be applied, Text needs to be contained within a layout component (such as Box or a generic div).
boolean
true
false
string
If truncate = tip, the full text content will be placed in a Tip that will appear on hover.
"tip"
At its core, the Text component is a regular <span> element. Thus, both DOM and React properties, methods, and events are accessible. To read up on all of the possible DOM attributes and types available for span elements, check out this MDN Web Documents page. To learn more about DOM events and methods, you can read more on the MDN Web Events documentation page.
Also, feel free to read about the types of React events available, or see how DOM attributes change in React. Working in tandem with Styled Components, you also have access to the as property.
The text color used for Text. In order for this to take effect, global.colors.background needs to be defined.
string
A hex, name, or rgb value.
"#444444"
object
An object with a color for dark and light modes.
{ dark: "#f8f8f8", light: "#444444" }
The possible sizes of the text in terms of its font-size and line-height.
object
{ xsmall: { size: '12px', height: '18px', }, small: { size: '14px', height: '20px', }, medium: { size: '18px', height: '24px', }, large: { size: '22px', height: '28px', }, xlarge: { size: '26px', height: '32px', }, xxlarge: { size: '34px', height: '40px', }, }
Any Skeleton properties which will be applied to the Text when in skeleton mode.
object
{ width: { width: '100px', min: '100px' }, margin: { vertical: 'xsmall' }, colors: { dark: ['border', 'border'], light: ['background-front', 'background-back'], } }