Skip to main content

Copytext

DhlCopyText component is used to preset the core textual content for our users. They are contained with headline and text and have few different variants which are tailored to the content we present.

Import

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

Code

<DhlCopyText>
<span slot="headline">Copy text headline</span>
<DhlText>Copy Text Content</DhlText>
</DhlCopyText>

Usage

Default DhlCopyText

Shows provided headline and the text in one column.

Example 2: Customise Headline and content columns

  • Uppercase headline which is red in color
  • Shows text in:
    • One column until viewport size md
    • Two columns from viewport size lg

Example 3: Bullet / Number List

  • In the content you can use any other content elements like Bullet list or Number list
  • You can also add margins to the bottom of the Copy Text component

Guidelines

  • Please check the Do's and Dont's for dhl-page-headline
  • Do use the one size as the default for copy text
  • Do use spacing to better organize textual information, such as different paragraphs

Readme

Properties

PropertyAttributeDescriptionTypeDefault
contentTextAligncontent-text-alignThis is an optional prop. Text-align of the content"center" \| "left" \| "right"undefined
dataClassNamedata-class-nameAn optional prop for the class of the root element.stringundefined
dataIddata-idAn optional prop. Gives a valid HTML ID attribute value for the component.stringdhl-copy-text-${getRandomString()}
dataTestiddata-testidAn optional prop. The test id attached to the component as a data-testid attribute.stringundefined
hasTwoColumnshas-two-columnsThis is an optional prop. Defines if the content is displayed in two columns in certain viewport widths; defaults to falsebooleanundefined
headlineColorheadline-colorThis is an optional prop. Color of the headline"black" \| "default" \| "red" \| "white"DHL_COPY_TEXT.HEADLINE_COLOR.BLACK
headlineLevelheadline-levelThis is an optional prop. Defines which font sizes and line heights are used1 \| 2 \| 3 \| 4 \| 5DHL_COPY_TEXT.HEADLINE_LEVEL[3]
headlineTagheadline-tagThis is an optional prop. Defines which headline tag to use. (h1-h6) defaults to H3. For a special case in which the element should not appear semantically as a headline; but should still get rendered in the same layout; it can additionally be rendered as a <p> tag."h1" \| "h2" \| "h3" \| "h4" \| "h5" \| "h6" \| "p"DHL_COPY_TEXT.HEADLINE_TAG.H3
headlineTextAlignheadline-text-alignThis is an optional prop. Text-align of the headline"center" \| "left" \| "right"undefined
headlineTextTransformheadline-text-transformThis is an optional prop. Text-transform state of the headline"capitalize" \| "lowercase" \| "none" \| "uppercase"DHL_COPY_TEXT.HEADLINE_TEXT_TRANSFORM.NONE

Slots

SlotDescription
"headline"used to supply Headline text
"unnamed"unnamed children slot for CopyText content

Dependencies

Depends on

Graph


Built by DHL User Interface Library Team!