Skip to main content

Getting Started

Installation

As a prerequisite, ensure you are using the following environment:

  • node version: 18.13.0
  • npm version: 8.19.3

To install the library, run the following command:

npm install @dhl-official/ui-libraries
info

The DUIL is not available in Artifactory.

Framework Setup

Import DUIL Custom Elements

To install the DUIL into your React application, import the following into your application entry-point:

import "@dhl-official/ui-libraries/duil-styles-all.css";
import { defineCustomElements } from "@dhl-official/ui-libraries/stencil-library/loader";

Ensure the defineCustomElements() function is called after ReactDOM.render() so that all DUIL custom elements are defined and registered in the browser's Custom Elements registry before they are used within the React components.

Example usage in React with Vite

import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App";
import "@dhl-official/ui-libraries/duil-styles-all.css";
import { defineCustomElements } from "@dhl-official/ui-libraries/stencil-library/loader";

ReactDOM.createRoot(document.getElementById("root")).render(
<React.StrictMode>
<App />
</React.StrictMode>
);
defineCustomElements();
You should now be able to use DUIL components as following within your React application:
<DhlButton>Button</DhlButton>

Troubleshooting

If you require installation support or have feedback on the installation documentaton, please contact us via the getting help page.

Known issues

If you are a Vue user, in some instances the .prop attribute is needed for certain properties e.g:

<DhlText size="sm" :isParagraph="isParagraph">Text</DhlText>

should be

<DhlText size="sm" :isParagraph.prop="isParagraph">Text</DhlText>