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

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

Interactive Demo

### Readme

Properties

PropertyAttributeDescriptionTypeDefault
buttonAlignbutton-alignAn optional prop that sets alignment of the button should the buttonOnly prop be set to true."center" \| "end" \| "start"DHL_PANEL.BUTTON_ALIGN.START
buttonOnlybutton-onlyAn optional prop used to set the variant of the accordion panel to a dhl-button component.booleanundefined
buttonVariantbutton-variantAn optional prop used to set the variant of button used when the buttonOnly prop is set to true."primary" \| "text"DHL_PANEL.BUTTON_VARIANT.PRIMARY
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.stringdhl-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
isDisabledis-disabledAn optional flag to define if the component is disabled.booleanfalse
panelIdpanel-idAn optional prop used to set the id of taggable Accordion panel - used to enable accessibility featuresstring${this.dataId}-panel-id

Events

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

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!