Upgrade Information
Install the React library11
To use the latest features and components, install the DHL User Interface Library for React following the instructions in Getting Started for Developers
All DUIL 1.0 components are now prefixed with Dhl e.g. Button is now DhlButton within Vue and React
In React, for example, Button is now DhlButton
In Vue & Angular, for example, Button is now dhl-button
Peer dependency
- styled-components are no longer needed as a peer dependency
Snapshot Testing
Be aware that whilst the component interface strives for backwards compatibility, many components have been subject to markup changes. Please update your snapshot testing suits during migration.
Using Slots
Composing components via children is a standard pattern in React. In React, components that support children will have a children prop that is then used in mark-up to reflect child nodes.
Web components achieve this through the use of <slot> tags, which reflect a placeholder for children nodes. Components which accept children nodes as part of their use-case are annotated as having unnamed slots within the documentation.
For example, the DhlIconWrapper supports an unnamed slot, intended to hold a DhlIcon.
before version 2.24
import CalendarFridayEnglish from "@dhl-official/ui-libraries/assets/icons/calendar-friday-english.svg";
<DhlIconWrapper animation="spin">
<DhlIcon src={CalendarFridayEnglish}></DhlIcon>
</DhlIconWrapper>;
from version 2.24
import CalendarFridayEnglish from "@dhl-official/icons/calendar-friday-english.svg";
<DhlIconWrapper animation="spin">
<DhlIcon src={CalendarFridayEnglish}></DhlIcon>
</DhlIconWrapper>;
As a consumer, simply place your element as a child of a parent that has an unnmamed slot.
Named slots
Within React, one common pattern used to ensure flexibility in component composition is using
"Compound Components". This is common in components such as Card, where you might use the Compound
Components Card.Header, Card.Body and Card.Footer. This pattern is supported within the DUIL through named slots,
a native approach supported by all output frameworks including React.
Components which support named slots specify the name of the slot and it's intended use on their respective documentation page.
For example, the DhlCard supports named slots header, footer and image to apply stylings unique to these sections.
<DhlCard>
<img
slot="image"
src={img320x200}
width="100%"
style={{ display: "block" }}
alt="A 320x200 sample yellow image"
/>
<DhlHeadline
slot="header"
designLevel="4"
noMargin
>
Header
</DhlHeadline>
<DhlText>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo
ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis
parturient montes, nascetur.
</DhlText>
<div slot="footer">
<DhlButton>Button</DhlButton>
</div>
</DhlCard>
Global Attribute Changes
The following global attributes used in DHL User Interface Library 1.0 require a data prefix in DHL User Interface Library 2.0 as shown below:
- Rename prop
ariaActivedescendanttodataAriaActivedescendant - Rename prop
ariaAtomictodataAriaAtomic - Rename prop
ariaAutoCompletetodataAriaAutoComplete - Rename prop
ariaControlstodataAriaControls - Rename prop
ariaDescribedbytodataAriaDescribedby - Rename prop
ariaDisabledtodataAriaDisabled - Rename prop
ariaExpandedtodataAriaExpanded - Rename prop
ariaOwnstodataAriaOwns - Rename prop
ariaHasPopuptodataAriaHasPopup - Rename prop
ariaHiddentodataAriaHidden - Rename prop
ariaInvalidtodataAriaInvalid - Rename prop
ariaLabeltodataAriaLabel - Rename prop
ariaLabelledbytodataAriaLabelledby - Rename prop
ariaLivetodataAriaLive - Rename prop
classNametodataClassName - Rename prop
idtodataId - Rename prop
titletodataTitle - Rename prop
langtodataLang - Rename prop
roletodataRole
Deprecated theming functions
Components
The following list describes removed properties, renamed properties and new properties for affected components alongside other notable changes.
For example code snippets and interactive demos, visit the Components tab.
Please note the removal of the isBlock property in the following components:
AutocompleteFieldCounterDropdownGlobalValidationInputFieldInputGroupSelectableCardSliderTextAreaFieldTrackingBar
We recommend using a GridContainer and GridCell components for positioning elements in your layout. This ensures that components take up only a specific portion of the available width, providing better layout control and responsiveness.
Accordion
-
The
AccordionContentcomponent is replaced byDhlPanel. -
Remove AccordionTitle. The title is now set on child element within Accordion via
slot="heading"- see Accordion docs for snippet. -
Rename
showExpandCollapseButtontobuttonOnly -
Remove
activeIndex -
Remove
focusedIndex -
Remove
onTitleClick -
Remove
buttonSize -
Remove
iconSize -
Remove
closeAlsoOnContentClick -
Remove
expandButtonAriaLabelandcollapseButtonAriaLabel-> content of expanding/collapsing button is determined by consume. -
Remove
useAsCollapsible -
Remove
expandButtonAriaControls->aria-controlsset through heading and panel id props. -
Remove
expandIconandcollapseIconprop -
Add
headingId&panelId -
Button variant available through
buttonOnlyset prop;headlineAlignment->buttonAlign
-
Limit
Headlinestyle to only exposeheadlineTagwithinAccordion:- Remove
weightprop - Remove
sizeprop
- Remove
AutocompleteField
- Rename
onBlurtoblurEvent - Rename
onChangetoinputEvent - Rename
onOptionSelectedtooptionSelected - Rename
ariaDescribetodataAriaDescribedby - Remove
renderOption - Remove
isBlock
BackToTop
- Rename
onClicktoclickEvent - Rename
onScrollCompletetoscrollCompleteEvent
Button
- Rename
onClicktoclickEvent - Rename
onKeyPresstokeyPressEvent
Card
- Compound components e.g. Card.Header are now defined through slots (see docs)
- Add
dataTestid
Checkbox
- Rename
onChangetochangeEvent - Rename
disabledtoisDisabled - Add
formnovalidate
Chip
- Rename
disabledtoisDisabled
Rename Controls to Counter
- Rename
onChangetochangeEvent - Rename
onBlurtoblurEvent - Rename
disabledtoisDisabled - Default
inputmodeisdecimal - Add
formnovalidate - Add
minandmaxfor setting Counter numerical limits - Remove
isBlock
DatePicker
- Aria labels now passed through required
localeLabelsprop - please see documentation for all available aria fields found within this object. - Rename
firstDayOfTheWeektofirstDayOfWeek - Remove
date - Remove
externalValidation - Rename
minDatetomin - Rename
maxDatetomax - Remove
isBlock - Remove
variant - Remove
displayFormatsee new propdateAdapterfor new implementation - Add
dataAriaLabelledby - Add
inputLabel - Add
isDisabled - Add
role - Add
direction - Add
dateAdapter - Add
isDateDisabled - Add
dhlChange - Add
dhlBlur - Add new event
dhlChange - Add new event
dhlFocus - Add new event
dhlOpen - Add new event
dhlClose - Add public method
setFocus - Add public method
show - Add public method
hide
Dropdown
- Options are now passed to
dataprop, passing options as children/childNodes in no longer supported. - Rename
disabledtoisDisabled - Rename
onChangetochangeEvent - Rename
onClicktoclickEvent - Rename
onClosetocloseEvent - Rename
onFilterChangetofilterChangeEvent - Rename
onOpentoopenEvent - Rename
ariaDescribetotextDescribe - Now a required prop:
dataId - Now a required prop:
name rightIconnow only supports string, a path to the icon or data url for the icon- Consumer to handle the filtration of the options on
filterChangeEvent - Remove
isBlock
Flex
- No longer supports responsive value array.
GlobalValidation
- Separated into two components -
DhlGlobalValidation&DhlIllustratedValidationfor the icon variant and illustration variant - The
variantprop now refers tovalidandinvalidstates - Rename
typetovariant - Remove
iconSize. The icon automatically scales in mobile viewport. - Rename
texttomessage - To use illustrated variant, use
GlobalIllustratedValidationcomponent
Headline
- Rename
fontStretchtostretch
Icons
- Import SVG and use in combination with the component:
before version 2.3.0
import CalendarFridayEnglish from "@dhl-official/ui-libraries/stencil-library/dist/icons/calendar-friday-english.svg";
<DhlIcon name={CalendarFridayEnglish}></DhlIcon>;
or
import {
CalendarFridayEnglish,
CalendarFridayGerman,
} from "@dhl-official/ui-libraries/assets/icons";
<DhlIcon name={CalendarFridayEnglish}></DhlIcon>;
<DhlIcon name={CalendarFridayGerman}></DhlIcon>;
from version 2.3.0
import CalendarFridayEnglish from "@dhl-official/icons/calendar-friday-english.svg";
<DhlIcon name={CalendarFridayEnglish}></DhlIcon>;
or
import {
CalendarFridayEnglish,
CalendarFridayGerman,
} from "@dhl-official/icons";
<DhlIcon name={CalendarFridayEnglish}></DhlIcon>;
<DhlIcon name={CalendarFridayGerman}></DhlIcon>;
Previous version of this documentation reported the below import path to use icons.
Note this is now deprecated and will be soon removed, please update your imports to the new one above.
import CalendarFridayEnglish from "stencil-library/dist/stencil-library/assets/calendar-friday-english.svg";
<DhlIcon name={CalendarFridayEnglish}></DhlIcon>;
IconWrapper
- Rename
animatetoanimation - Rename
speedtoduration - Update values of prop speed from SLOWER to "5x", SLOW to "4x", STANDARD to 3x", FAST to "2x"
- Add
dataClassName
Illustrations
- Moved to Icons and pre-fixed with
illu-
InputField
- Rename
onBlurtoblurEvent - Rename
disabledtoisDisabled - Rename
onChangetoinputEvent rightIconnow supplied via slot nameright-icon- Remove prop
ariaExpanded - Remove
isBlock - Add
formnovalidate - Add
dataAriaActivedescendant - Add
dataAriaAutoComplete - Add
dataAriaExpanded - Add
autoComplete - Add
dataAriaOwns - Add
focusEvent - Add
keyDownEvent - Add
dataRole
InputGroup
rightIcononly supports string, a path to the icon or data url for the icon- Rename
disabledtoisDisabled - Remove
isBlock
Image
- Rename
srcSettosrcset
Link
- Remove
withButtonStyleprop object:isBlock,sizeandvariantare now directly applicable - Add
dataTitle
Logos
- Now implemented through
Icons
Modal
- Rename
onClosetohandleOnClose - Rename
isStatictotrapFocus handleOnShowandhandleOnClosenow optionally return the dialog element and the event- Add
handleOnShowprop for function call when dialog open
Navbar
- The
popoverprop now takes astringinstead of a (popover)node - Remove
navActions SearchDatasimplified to a link - to be refactored once designs updated- If
itemsare not supplied to themobileNavigationItemsprop,Navbarwill auto-generateitemsbased onprimaryNavigationItemsand theheadlineproperty.
Page Headline
- Remove
mainHeadlineContent, the content to be passed as children of the component - Remove
subHeadlineContent, the content to be passed as children to the named slotsubHeadline - Add
hasSubHeadlineto mention if the sub heading content is passed - Remove
marginBottom
Popover
- Discontinue use of
Popper.js. - Update
placementto hold valuestop,right,bottomandleft - Add
useLabelledby - Remove
offset - Remove
popperOptions - Remove
popoverTriggerAriaLabel - Remove
showCloseButton - Remove
closeButtonAriaLabel - Remove
heading - Remove
trigger - Remove
closeOnOutsideClick
ProgressIndicator
- Rename
onClickHandlertoclickEvent
RadioButton
- Rename
onChangetochangeEvent - Rename
disabledtoisDisabled - Add
formnovalidate
SelectableCard
- Rename
onChangetochangeEvent - Remove
isFullBleed - Remove
isBlock - Add
formnovalidate
Slider
- Remove
validation - Remove
isBlock - Rename
colortocolorVariant - Rename
disabledtoisDisabled - Steps can now be used without graphic indicator - to toggle, use
showStep/show-step
Stage
Stage.Actionboxchanged todhl-stage-action-boxStage.Introchanged todhl-stage-introStage.Numberschanged todhl-stage-numbersStage.Tileschanged todhl-stage-tiles- Remove
Stage.AddShipmentLink - Remove
Stage.TrackingBar, usedhl-tracking-barwithmargin: var(--dui-size-space-8x) 0; stageLinkcontent is rendered in named slotlinkstageCopyTextonly supportsstringupperHeadlineTextonly supportsstringmainHeadlineTextonly supportsstring- When rendering
numbersvariant, theDhlStageNumbershave to be rendered twice, once as direct children and in named slotnumbersto achieve responsiveness for larger screens
Stage.Actionbox
headlineprop changed to use named slotheadlinesublineprop changed to use named slotsublineiconprop now expects an icon relative or data path- Link content is rendered in named slot
stageLink
Stage.Tiles
mainHeadlineTextnow only supportsstringpseudoLinkTextnow only supportsstringupperHeadlineTextnow only supportsstring
Switch
- Rename
onChangetochangeEvent - Rename
disabledtoisDisabled - Rename
colortovariantprop
Table
- Now a required prop:
columns - Rename field
aligntotext-alignwithin therowDataprop
Tabs
- Rename
onChangetochangeEvent - Prefix props
labelanddisabledwithdataon li elements - Remove custom labels
TextAreaField
- Rename
disabledtoisDisabled - Remove
isBlock
TrackingBar
- Rename
onBlurtoblurEvent - Rename
disabledtoisDisabled - Rename
onSubmittosubmitEvent - Rename
onChangetochangeEvent - Remove
isBlock
Validation Feedback
- Rename
Validationtype toDhlValidationFeedbackValidationType