Skip to main content

IconWrapper

The IconWrapper component is used to easily define the behaviour of children Icon(s) through a set of exposed props.

Import

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

Code

import CalendarFridayEnglish from "@dhl-official/icons/calendar-friday-english.svg";

<DhlIconWrapper>
<DhlIcon src={CalendarFridayEnglish}></DhlIcon>
</DhlIconWrapper>

Interactive Demo

Migrating from DUIL 1.0

  • Rename animate to animation
  • Rename speed to duration
  • Update values of prop speed from SLOWER to "5x", SLOW to "4x", STANDARD to 3x", FAST to "2x"
  • Add dataClassName

Readme

Properties

PropertyAttributeDescriptionTypeDefault
animationanimationAn optional prop used to set the animation style of the icon-wrapper"appearFromSide" | "appearFromTop" | "disappearFromBottom" | "spin"undefined
blockblockAn optional prop used to indicate whether the element should behave as a block elementbooleanundefined
colorcolorAn optional prop, used to set the color of the component.stringundefined
dataAriaHiddendata-aria-hiddenAn optional prop used to indicate whether the element is exposed to an accessibility API.string"true"
dataAriaLabeldata-aria-labelAn optional prop used to define the accessible name of the component.stringundefined
dataClassNamedata-class-nameAn optional class name prop for the component.stringundefined
dataRoledata-roleAn optional prop defining the role attribute of the component.string"presentation"
dataTestiddata-testidAn optional prop. The test id attached to the component as a data-testid attribute.stringundefined
durationdurationAn optional prop used to set the animation speed of the icon-wrapper"0x" | "1x" | "2x" | "3x" | "4x" | "5x" | "infinite"DHL_ICON_WRAPPER.DURATION["3x"]
rotaterotateAn optional prop used to set the icon-wrapper rotationstringundefined
sizesizeAn optional size prop for the component."lg" | "md" | "sm" | "xl"DHL_ICON_WRAPPER.SIZE.SM
variantvariantAn optional prop to select a component design variant."error" | "inverted" | "note" | "primary" | "secondary" | "success" | "sustainability" | "warning"undefined

Slots

SlotDescription
"unnamed"unnamed children slot intended for DhlIcon

Dependencies

Used by

Graph


Built by DHL User Interface Library Team!