Skip to main content

Text

The Text component is used to display text with available prop values adhering to brand styling rules.

Import

// with @dhl-official/react-library:
import { DhlText } from "@dhl-official/react-library"
// with @dhl-official/ui-libraries/react-library:
import { DhlText } from "@dhl-official/ui-libraries/react-library"

Guidelines

  • Please note that if no values are supplied to the size and weight prop respectively, then the Text component inherits these values from their parent.

Code

<DhlText>Example Text</DhlText>

Interactive Demo

Readme

Properties

PropertyAttributeDescriptionTypeDefault
dataAriaAtomicdata-aria-atomicAn optional prop used to indicate whether assistive technologies such as a screen reader will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute.stringundefined
dataAriaHiddendata-aria-hiddenAn optional prop used to indicate whether the element is exposed to an accessibility API.stringundefined
dataAriaLabeldata-aria-labelAn optional prop defining the text read by the screen reader to represent the component; use this if you need different text to be read from label.stringundefined
dataAriaLabelledbydata-aria-labelledbyAn optional ariaLabelledby prop that establishes the relationships between objects and their label(s), and its value should be one or more element IDs, which refer to elements that have the text needed for labelling. List multiple element IDs in a space delimited fashion.stringundefined
dataAriaLivedata-aria-liveAn optional prop used to expose dynamic content changes in a way that can be announced by assistive technologies.stringundefined
dataClassNamedata-class-nameAn optional class name prop for the component.stringundefined
dataIddata-idAn optional prop. Gives a valid HTML ID attribute value for the component.stringdhl-text-${getRandomString()}
dataLangdata-langAn optional prop used to set the lang attribute of the Text componentstringundefined
dataRoledata-roleAn optional prop defining the role attribute of the component.stringundefined
dataTestiddata-testidAn optional prop. The test id attached to the component as a data-testid attribute.stringundefined
dataTitledata-titleAn optional prop used to set the title for the text component.stringundefined
fontStylefont-styleAn optional prop used to set the font-style property of the text component."italic" \| "normal"undefined
isParagraphis-paragraphAn optional prop used to set if ReadMore should use a <p> instead of a <span> tag.booleanfalse
sizesizeAn optional size prop for the component."10xl" \| "11xl" \| "2xl" \| "2xs" \| "3xl" \| "4xl" \| "5xl" \| "6xl" \| "7xl" \| "8xl" \| "9xl" \| "lg" \| "md" \| "sm" \| "xl" \| "xs"DHL_TEXT.SIZE.MD
stretchstretchAn optional prop used to set the font-stretch property of the component."condensed" \| "normal"undefined
weightweightAn optional prop used to set the font-weight property of the text component.200 \| 400 \| 700 \| 800DHL_TEXT.WEIGHT[400]

Slots

SlotDescription
"unnamed"unnamed children slot intended for Text text

Dependencies

Used by

Graph


Built by DHL User Interface Library Team!