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
clickEventclick-eventAn optional onClick callback handler.(e: any) => voidundefined
dataClassNamedata-class-nameAn optional class name prop for the component.stringundefined
dataIddata-idAn optional prop. Gives a valid HTML ID attribute value for the component.string`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 featuresstring`${this.dataId}-heading-id`
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
isDisabledis-disabledAn optional flag to define if the component is disabled.booleanfalse
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 featuresstring`${this.dataId}-panel-id`
variantvariantAn optional prop used to set the visual style variant."border" | "naked" | "no-border"undefined

Events

EventDescriptionType
dhlExpandThe event emitted to dhl-accordion which includes information about the expanded statusCustomEvent<{ expanded: boolean; }>

Methods

panelOnReady() => Promise<HTMLDhlPanelElement>

Returns

Type: Promise<HTMLDhlPanelElement>

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!