Tag
The Tag is a compact element that helps users quickly scan and identify categorized information. It is available in filled and outlined styles, in the neutral, positive, negative, warning, information and brand categories, and in sm and md sizes. An optional dot icon can be shown before the label with hasIcon.
The Tag is purely informative: it is not focusable and has no click behavior. Because the category is communicated by color, the label itself must describe the meaning (e.g. "Delivered" rather than relying on a green tag).
Import
- React
- Angular
- Vue.js
// with @dhl-official/react-library:
import { DhlTag } from "@dhl-official/react-library"
// with @dhl-official/ui-libraries/react-library:
import { DhlTag } from "@dhl-official/ui-libraries/react-library"
If the DUIL has been installed, you can use the web component directly:
<duil321-dhl-tag></duil321-dhl-tag>
If the DUIL has been installed, you can use the web component directly:
<duil321-dhl-tag></duil321-dhl-tag>
Code
- React
- Angular
- Vue.js
<DhlTag tagStyle="filled" category="positive" size="md" textValue="Delivered" hasIcon></DhlTag>
<duil321-dhl-tag tag-style="filled" category="positive" size="md" text-value="Delivered" has-icon></duil321-dhl-tag>
<duil321-dhl-tag tag-style="filled" category="positive" size="md" text-value="Delivered" has-icon></duil321-dhl-tag>
Examples
Filled
Code example
<DhlTag category="neutral" textValue="Neutral" />
<DhlTag category="positive" textValue="Positive" />
<DhlTag category="negative" textValue="Negative" />
<DhlTag category="warning" textValue="Warning" />
<DhlTag category="information" textValue="Information" />
<DhlTag category="brand" textValue="Brand" />
Outlined, medium, with icon
Code example
<DhlTag tagStyle="outlined" size="md" hasIcon category="neutral" textValue="Neutral" />
<DhlTag tagStyle="outlined" size="md" hasIcon category="positive" textValue="Positive" />
<DhlTag tagStyle="outlined" size="md" hasIcon category="negative" textValue="Negative" />
<DhlTag tagStyle="outlined" size="md" hasIcon category="warning" textValue="Warning" />
<DhlTag tagStyle="outlined" size="md" hasIcon category="information" textValue="Information" />
<DhlTag tagStyle="outlined" size="md" hasIcon category="brand" textValue="Brand" />
Interactive Demo
Readme
Properties
| Property | Attribute | Description | Type | Default |
|---|---|---|---|---|
category | category | An optional prop to select the component category. | "brand" | "information" | "negative" | "neutral" | "positive" | "warning" | DHL_TAG.CATEGORY.NEUTRAL |
dataTestid | data-testid | An optional prop. The test id attached to the component as a data-testid attribute. | string | undefined |
hasIcon | has-icon | An optional boolean prop to show a dot icon before the label. | boolean | false |
size | size | An optional size prop for the component. | "md" | "sm" | DHL_TAG.SIZE.SM |
tagStyle | tag-style | An optional prop to select the component style (filled or outlined). | "filled" | "outlined" | DHL_TAG.STYLE.FILLED |
textValue | text-value | An optional prop to set the component label. | string | "Tag label" |
Built by DHL User Interface Library Team!