Skip to main content

Sidenav

The Sidenav component is a collapsible vertical navigation menu for app layouts, ideal for organizing primary sections and saving space. Use the collapsed variant to minimize the sidebar, showing only icons, and expand it for full text labels. Ensure the component is placed within a flexible container that adjusts to its width changes.

Import

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

Code

<DhlSidenav
appName="Express"
logo={{
title: "Express",
alt: "Express",
href: "https://www.dhl.com/",
external: "_blank",
}}
mainItems={[
{
label: "Nav Item",
icon: icons.PlaneTakeOff,
isPrimary: true,
items: [
{ label: "Sub Item" },
{ label: "Sub Item" },
{ label: "Sub Item" },
],
},
{
label: "Nav Item",
icon: icons.Parcel,
items: [
{ label: "Sub Item" },
{ label: "Sub Item" },
{ label: "Sub Item" },
],
},
{
label: "Nav Item",
icon: icons.LiveTracking,
items: [
{ label: "Sub Item" },
{ label: "Sub Item" },
{ label: "Sub Item" },
],
},
{
label: "Nav Item",
icon: icons.DeliveryVan,
items: [
{ label: "Sub Item" },
{ label: "Sub Item" },
{ label: "Sub Item" },
],
},
{
label: "Nav Item",
icon: icons.CurrencyChange,
items: [
{ label: "Sub Item" },
{ label: "Sub Item" },
{ label: "Sub Item" },
],
},
{
label: "Nav Item",
icon: icons.EmergingMarketSolutions,
},
{
label: "Nav Item",
icon: icons.Group,
},
]}
bottomItems={[
{
label: "Nav Item",
icon: icons.LocationPin,
},
{
label: "Nav Item",
icon: icons.Questionmark,
},
]}
></DhlSidenav>

Interactive Demo

Readme

Properties

PropertyAttributeDescriptionTypeDefault
allowMultipleDrawersToggleallow-multiple-drawers-toggleAn optional flag to define if component can toggle multiple drawers at the same time.booleanfalse
appNameapp-nameIf present shows the application name next to the DHL logo.stringundefined
bottomItemsbottom-itemsAn optional prop to pass the list of bottom navigation items.DhlSideNavOptionType[][]
dataAriaLabeldata-aria-labelAn optional prop defining the text read by the screen reader to represent the component; use this if you need different text to be read from label.stringundefined
dataTestiddata-testidAn optional prop. The test id attached to the component as a data-testid attribute.stringundefined
isCollapsedis-collapsedAn optional prop to define if component is in collapsed state.booleanfalse
logologoThis is optional prop of the below shape that controls the behavior of the DHL Logo i.e. the title, alternate text, href etc.ItemLink & { alt: string; }undefined
mainItemsmain-itemsAn optional prop to pass the list of main navigation items.DhlSideNavOptionType[][]

Dependencies

Depends on

Graph


Built by DHL User Interface Library Team!