Sidenav

The sidenav component is part of the layout of the application and it makes easier to divide the main screen into two different areas. The main area will have all the content and the sidenav as a secondary element as an index, including links to different resources on the web page.

The sidenav is part of the application layout, so it can only be used inside of it. Please check the DxcApplicationLayout documentation.

Props

NameTypeDescriptionDefault
titleReact.ReactNodeThe area assigned to render the title. It is highly recommended to use the sidenav title.-
Required
children
React.ReactNodeThe area inside the sidenav.-

DxcSidenav.Title

This compound component should only be used inside the title prop.

Props

NameTypeDescriptionDefault
Required
children
React.ReactNodeThe area inside the sidenav title. This area can be used to render custom content.-

DxcSidenav.Section

Sections must be defined as direct children of the DxcSidenav and serve to group links, groups and/or custom content into different and distinguishable parts of the component. Consecutive sections are separated by a divider.

Props

NameTypeDescriptionDefault
Required
children
React.ReactNodeThe area inside the sidenav section. Child items will be stacked inside a flex container.-

DxcSidenav.Group

Even though any children are accepted in a group, we recommend using only the DxcSidenav.Link or any React-based router, complemented with this one, as links to the different pages.

Props

NameTypeDescriptionDefault
titlestringThe title of the sidenav group.-
collapsablebooleanIf true, the sidenav group will be a button that will allow you to collapse the links contained within it. In addition, if it's collapsed and contains the currently selected link, the group title will also be marked as selected.false
iconstring | (React.ReactNode & React.SVGProps <SVGSVGElement>)A Material Symbol or a SVG element to be displayed next to the title of the group as an icon.-
Required
children
React.ReactNodeThe area inside the sidenav group. This area can be used to render sidenav links.-

As with the DxcLink component, we decided to make our Sidenav link component a styled HTML anchor that can be used with any React-based router. You can check the Link for more information regarding this.

NameTypeDescriptionDefault
hrefstringPage to be opened when the user clicks on the link.-
newWindowbooleanIf true, the page is opened in a new browser tab.false
iconstring | (React.ReactNode & React.SVGProps <SVGSVGElement>)A Material Symbol or a SVG element to be displayed left to the link as an icon.-
selectedbooleanIf true, the link will be marked as selected. Moreover, in that same case, if it is contained within a collapsed group, and consequently, the currently selected link is not visible, the group title will appear as selected too.false
onClick(event: React.MouseEvent <HTMLAnchorElement>) => voidThis function will be called when the user clicks the link and the event will be passed to this function.-
Required
children
React.ReactNodeThe area inside the sidenav link.-
tabIndexnumberValue of the tabindex attribute.0

Examples

Application layout with sidenav