Skip to main content

Panel

A Panel must be used as a direct child of the Accordion component. Its aim is to group content and a heading together. The heading is used to toggle the visibility of the content via a named slot heading.

Import

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

Code​

<DhlAccordion>
<DhlPanel>
<span slot="heading">First heading</span>
<DhlText>This is the content related to the first headline</DhlText>
</DhlPanel>
</DhlAccordion>

Interactive Demo​

Variants​

Expanded Panel​

Use expanded when the panel content should be visible on initial render.

<DhlAccordion>
<DhlPanel expanded>
<span slot="heading">Shipment status</span>
<DhlText>
Your parcel has reached the regional sorting facility and is being
prepared for the next transport leg.
</DhlText>
</DhlPanel>
</DhlAccordion>
Shipment status

Your parcel has reached the regional sorting facility and is being prepared for the next transport leg.

Borderless Panel​

Use noBorder when the surrounding surface already provides clear separation.

<DhlAccordion>
<DhlPanel expanded noBorder>
<span slot="heading">Additional information</span>
<DhlText>
Use a borderless panel when the surrounding surface already provides
clear separation.
</DhlText>
</DhlPanel>
</DhlAccordion>
Additional information

Use a borderless panel when the surrounding surface already provides clear separation.

Readme​

Properties​

PropertyAttributeDescriptionTypeDefault
dataClassNamedata-class-nameAn optional class name prop for the component.stringundefined
dataIdidAn optional prop. Gives a valid HTML ID attribute value for the component.string`duil320-dhl-panel-${getRandomString()}`
dataTestiddata-testidAn optional prop. The test id attached to the component as a data-testid attribute.stringundefined
expandedexpandedAn optional prop that toggles if the panel is expandedbooleanfalse
headingIdheading-idAn optional prop used to set the id of taggable Accordion heading - used to enable accessibility featuresstringundefined
headingTagheading-tagAn optional prop. Defines which headline tag to use. (h1-h6)."h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p"DHL_PANEL.HEADING_TAG.H1
iconTypeicon-typeAn optional prop that selects the expand/collapse icon set."chevron" | "plus-minus"undefined
noBorderno-borderAn optional prop used to remove the top and bottom border lines from the panel.booleanfalse
panelIdpanel-idAn optional prop used to set the id of taggable Accordion panel - used to enable accessibility featuresstringundefined
variantvariantAn optional prop used to set the visual style variant."border" | "naked" | "no-border"undefined

Events​

EventDescriptionType
dhlClickEvent emitted when the panel is clicked.CustomEvent<MouseEvent>
dhlExpandEvent emitted when the panel's expanded status changes.CustomEvent<{ expanded: boolean; }>

Methods​

panelOnReady() => Promise<HTMLDuil320DhlPanelElement>​

Returns​

Type: Promise<HTMLDuil320DhlPanelElement>

Slots​

SlotDescription
"heading"used to supply the component headline text
"unnamed"unnamed children slot for component content

Dependencies​

Depends on​

Graph​


Built by DHL User Interface Library Team!