NavList

Alpha component

NavList component is subject to major changes and is for experimentation purposes only. Not recommended for use in production software.

NavList can be used to render a sidebar navigation list

Import

import { NavList } from '@contentful/f36-navlist';

Examples

NavList can be used to render vertical navigation list, it can be used for links and for buttons:

  • NavList can be rendered as nav or div
  • NavList.Item can be rendered as button or a

Basic

Basic example of NavList rendered with links

With buttons

Example of NavList using button as items

Controlled

Example of controlled NavList

With active and disabled states

Example with items with active or disabled state

Props (API reference)

Open in Storybook

Name

Type

Default

children
required
ReactNode

as
HTML Tag or React Component (e.g. div, span, etc)

nav
className
string

CSS class to be appended to the root element

testId
string

A [data-test-id] attribute used for testing purposes

Name

Type

Default

as
HTML Tag or React Component (e.g. div, span, etc)

a
children
ReactNode

className
string

CSS class to be appended to the root element

isActive
false
true

Marks item as active

isDisabled
false
true

Marks item as disabled

testId
string

A [data-test-id] attribute used for testing purposes

Content guidelines

Link names should be shor and descriptive

Accessibility

  • If rendered with div the role of navigation is set.
  • NavList can be passed an aria-label to override the default Sidebar