Skip to main content

Icon

Import

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

Code

Option 1
import CalendarFridayEnglish from "@dhl-official/icons/calendar-friday-english.svg";
<DhlIcon src={CalendarFridayEnglish}></DhlIcon>
Option 2
import { CalendarFridayEnglish } from "@dhl-official/icons";
<DhlIcon src={CalendarFridayEnglish}></DhlIcon>
Option 3
import { icons } from "@dhl-official/icons";
<DhlIcon src={icons.calendarFridayEnglish}></DhlIcon>

Interactive Demo

Complete List

Migrating from DUIL 1.0

  • Import SVG and use in combination with the component:
from version 2.4.0
import CalendarFridayEnglish from "@dhl-official/icons/calendar-friday-english.svg";
<DhlIcon src={CalendarFridayEnglish}></DhlIcon>;

or

import {
CalendarFridayEnglish,
CalendarFridayGerman,
} from "@dhl-official/icons";
<DhlIcon src={CalendarFridayEnglish}></DhlIcon>;
<DhlIcon src={CalendarFridayGerman}></DhlIcon>;
before version 2.4.0
import CalendarFridayEnglish from "@dhl-official/ui-libraries/stencil-library/dist/icons/calendar-friday-english.svg";
<DhlIcon src={CalendarFridayEnglish}></DhlIcon>;

or

import {
CalendarFridayEnglish,
CalendarFridayGerman,
} from "@dhl-official/icons";
<DhlIcon src={CalendarFridayEnglish}></DhlIcon>;
<DhlIcon src={CalendarFridayGerman}></DhlIcon>;
danger

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 src={CalendarFridayEnglish}></DhlIcon>;

Readme

Properties

PropertyAttributeDescriptionTypeDefault
altaltAn optional prop used to specify the alt text within the component.stringundefined
dataAriaHiddendata-aria-hiddenAn optional prop used to indicate whether the element is exposed to an accessibility API.string"true"
dataIddata-idAn optional prop. Gives a valid HTML ID attribute value for the component.stringdhl-icon-${getRandomString()}
dataRoledata-roleAn optional prop defining the role attribute of the component."image" \| "presentation"DHL_ICON.ROLE.PRESENTATION
dataTestiddata-testidAn optional prop. The test id attached to the component as a data-testid attribute.stringundefined
isIllustrationis-illustrationAn optional prop used to specify if the icon is an illustrationbooleanundefined
sizesizeAn optional prop used to set the size of the component, any valid dimension attributes. The value set to this prop is ignored when the component is nested into a dhl-icon-wrapper component.string"1rem"
srcsrcA REQUIRED prop used to specify the image source.stringundefined

Dependencies

Used by

Graph


Built by DHL User Interface Library Team!