Skip to main content

GlobalValidation

The GlobalValidation component is used to easily display the validation state to the consumer with an accompanied headline, message, and icon indicator.

Import

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

Code

<DhlGlobalValidation
headlineText="Success!"
headlineTag="h1"
message="Offers were found that match your selection"
variant="valid"
></DhlGlobalValidation>

Interactive Demo

Migrating from DUIL 1.0

  • Separated into two components - DhlGlobalValidation & DhlIllustratedValidation for the icon variant and illustration variant
  • The variant prop now refers to valid and invalid states
  • Rename type to variant
  • Remove iconSize. The icon automatically scales in mobile viewport.
  • Rename text to message
  • To use illustrated variant, use GlobalIllustratedValidation component

Readme

Properties

PropertyAttributeDescriptionTypeDefault
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-global-validation-${getRandomString()}
dataTestiddata-testidAn optional prop. The test id attached to the component as a data-testid attribute.stringundefined
headlineTagheadline-tagThis is an optional prop. Defines which headline tag to use. (h1-h6) defaults to H1. 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_GLOBAL_VALIDATION.HEADLINE_TAG.H1
headlineTextheadline-textAn optional prop used to set the headline textstringundefined
messagemessageAn optional prop used to set the validation messagestringundefined
variantvariantAn optional prop to select a component design variant."invalid" \| "valid"DHL_GLOBAL_VALIDATION.VARIANT.VALID

Dependencies

Depends on

Graph


Built by DHL User Interface Library Team!