sp-sidenav

Examples API Changelog

Attributes and Properties #

Property Attribute Type Default Description disabled disabled boolean false Disable this control. It will not receive focus or events label label string | undefined | undefined undefined An accessible label that describes the component, so that the side navigation can be distinguished from other navigation by screen reader users. It will be applied to aria-label, but not visually rendered. manageTabIndex manage-tab-index boolean false tabIndex tabIndex number The tab index to apply to this control. See general documentation about the tabindex HTML property value value string | undefined undefined variant variant 'multilevel' | undefined undefined The multilevel variant will have multiple layers of hierarchical navigation items.

Slots #

Name Description default slot the Sidenav Items to display

Events #

Name Type Description change Event Announces a change in the `value` property of the navigation element. This change can be "canceled" via `event.preventDefault()`.

1.0.0 (2024-10-31) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.49.0 (2024-10-15) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.48.1 (2024-10-01) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.48.0 (2024-09-17) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.47.2 (2024-09-03) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.47.1 (2024-08-27) #

Bug Fixes #

  • reactive-controllers: update focusable element's tab-index to 0 on accepting focus (#4630) (d359e84)

0.47.0 (2024-08-20) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.46.0 (2024-08-08) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.45.0 (2024-07-30) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.44.0 (2024-07-15) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.43.0 (2024-06-11) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.42.5 (2024-05-24) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.42.4 (2024-05-14) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.42.3 (2024-05-01) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.42.2 (2024-04-03) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.42.1 (2024-04-02) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.42.0 (2024-03-19) #

Features #

  • asset: use core tokens (99e76f4)

0.41.2 (2024-03-05) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.41.1 (2024-02-22) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.41.0 (2024-02-13) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.40.5 (2024-02-05) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.40.4 (2024-01-29) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.40.3 (2024-01-11) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.40.2 (2023-12-18) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.40.1 (2023-12-05) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.40.0 (2023-11-16) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.39.4 (2023-11-02) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.39.3 (2023-10-18) #

Bug Fixes #

  • update deps graph, fix imports (f633005)

0.39.2 (2023-10-13) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.39.1 (2023-10-06) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.39.0 (2023-09-25) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.38.0 (2023-09-05) #

Bug Fixes #

  • sidenav: reintroduce support for slotted label content (26c7e6e)

0.37.0 (2023-08-18) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.36.0 (2023-08-18) #

Features #

  • sidenav: migrate to core tokens (1846aa3)

0.35.0 (2023-07-31) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.34.0 (2023-07-11) #

Bug Fixes #

  • sidenav: express hierarchy using list and listitem (f9019d7), closes #3348 #3348

0.33.2 (2023-06-14) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.33.0 (2023-06-08) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.32.0 (2023-06-01) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.31.0 (2023-05-17) #

Bug Fixes #

  • generate react/picker and pass react TS checks (101b88c)

0.30.0 (2023-05-03) #

Bug Fixes #

  • #2933 by adding optional variant property to SideNav (9c45c33)
  • correct @element jsDoc listing across library (c97a632)
  • correct a11y tree (f7e54e5)
  • correctly track "activeElement" across shadow boundaries (8b9f93a)
  • ensure browser understandable extensions (f4e59f7)
  • ensure item exists when attempting to acquire next item to focus (fb52cea)
  • fix expanding sidenav item that has no value (b28cdac)
  • include "type" in package.json, generate custom-elements.json (1a8d716)
  • include default export in the "exports" fields (f32407d)
  • include the "types" entry in package.json files (b432f59)
  • normalize "event" and "error" argument names (8d382cd)
  • prevent infinite loops when all children are [disabled] (2deac3d)
  • prevent tabindex=-1 elements from placing focus on their host (1ac1293)
  • sidenav: add aria-current when using href with sidenav-item (9172639)
  • sidenav: add support for icons and document icons/headlines (9ddb363)
  • sidenav: manage tabindex when interacting with keyboard (ea977cf)
  • sidenav: prevent items with hrefs from toggling expanded or selection (7ff4920)
  • sidenav: tighten Spectrum adherence and sharpen docs delivery (d4c70cd)
  • stop merging selectors in a way that alters the cascade (369388f)
  • style clean up (49e1537)
  • update consumption of Spectrum CSS for latest version (ed2305b)
  • update latest Spectrum CSS beta releases (d8d3acc)
  • update side effect listings (8160d3a)
  • update slotting in "sp-sidenav-item" to allow for labelling in HTML (928c476)
  • update to latest spectrum-css packages (a5ca19f)
  • use latest @spectrum-css/* versions (c35eb86)

Features #

  • action-button: add action button pattern (03ac00a)
  • adopt DNA@7 base Spectrum CSS (e08cafd)
  • icons-workflow: vend fully registered icon components (941f3a4)
  • implement #2964 for sidenav component (99afac9)
  • implement #2964 for sidenav component (5bf36e5)
  • include all Dev Mode files in side effects (f70817c)
  • leverage "exports" field in package.json (321abd7)
  • shared pkg versions, devmode define warning, registry-conflicts docs (6e49565)
  • sidenav: add a "change" event to track the "value" property (8d3a0bd)
  • sidenav: add keyboard accessibility (6ff622b)
  • sidenav: update spectrum css input (bd43201)
  • support rel attribute for sidenav item (90522e7)
  • update to Spectrum CSS v3.0.0 (e8b3d8f)
  • use :focus-visable (via polyfill) instead of :focus (11c6fc7)
  • use @adobe/spectrum-css@2.15.1 (3918888)
  • use latest exports specification (a7ecf4b)

Performance Improvements #

  • use "sideEffects" listing in package.json (7271614)
  • use imported TypeScript helpers instead of inlining them (cc2bd0a)

Reverts #

  • Revert "chore: release new versions" (a6d655d)

0.14.3 (2023-04-24) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.14.2 (2023-04-05) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.14.1 (2023-03-22) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.14.0 (2023-03-08) #

Features #

  • implement #2964 for sidenav component (99afac9)
  • implement #2964 for sidenav component (5bf36e5)

0.13.10 (2023-02-21) #

Bug Fixes #

  • #2933 by adding optional variant property to SideNav (9c45c33)

0.13.9 (2023-02-08) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.13.8 (2023-01-23) #

Bug Fixes #

  • sidenav: prevent items with hrefs from toggling expanded or selection (7ff4920)

0.13.7 (2023-01-09) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.13.6 (2022-12-08) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.13.5 (2022-11-21) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.13.4 (2022-11-14) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.13.3 (2022-10-28) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.13.2 (2022-10-17) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.13.1 (2022-10-10) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.13.0 (2022-08-09) #

Features #

  • include all Dev Mode files in side effects (f70817c)

0.12.15 (2022-08-04) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.12.14 (2022-07-18) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.12.13 (2022-06-29) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.12.12 (2022-06-07) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.12.11 (2022-05-27) #

Bug Fixes #

  • update consumption of Spectrum CSS for latest version (ed2305b)

0.12.10 (2022-05-12) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.12.9 (2022-04-21) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.12.8 (2022-03-30) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.12.7 (2022-03-08) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.12.6 (2022-03-04) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.12.5 (2022-02-22) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.12.4 (2022-02-02) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.12.3 (2022-01-26) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.12.2 (2022-01-07) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.12.1 (2021-12-13) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.12.0 (2021-11-08) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.11.1 (2021-11-08) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.11.0 (2021-11-02) #

Features #

  • adopt DNA@7 base Spectrum CSS (e08cafd)

0.10.10 (2021-10-12) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.10.9 (2021-09-20) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.10.8 (2021-09-13) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.10.7 (2021-08-24) #

Bug Fixes #

  • correct @element jsDoc listing across library (c97a632)

0.10.6 (2021-08-17) #

Bug Fixes #

  • update slotting in "sp-sidenav-item" to allow for labelling in HTML (928c476)

0.10.5 (2021-07-22) #

Bug Fixes #

  • style clean up (49e1537)

0.10.4 (2021-07-01) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.10.3 (2021-06-16) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.10.2 (2021-06-07) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.10.1 (2021-05-24) #

Bug Fixes #

  • prevent tabindex=-1 elements from placing focus on their host (1ac1293)

0.10.0 (2021-05-12) #

Bug Fixes #

  • ensure item exists when attempting to acquire next item to focus (fb52cea)

Features #

  • sidenav: add a "change" event to track the "value" property (8d3a0bd)

0.9.5 (2021-04-15) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.9.4 (2021-04-09) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.9.3 (2021-03-29) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.9.2 (2021-03-22) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.9.1 (2021-03-05) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.9.0 (2021-03-04) #

Features #

  • use latest exports specification (a7ecf4b)

0.8.1 (2021-02-11) #

Bug Fixes #

  • update to latest spectrum-css packages (a5ca19f)

0.8.0 (2021-01-21) #

Bug Fixes #

  • include the "types" entry in package.json files (b432f59)
  • prevent infinite loops when all children are [disabled] (2deac3d)
  • stop merging selectors in a way that alters the cascade (369388f)
  • update latest Spectrum CSS beta releases (d8d3acc)
  • use latest @spectrum-css/* versions (c35eb86)

Features #

  • action-button: add action button pattern (03ac00a)
  • icons-workflow: vend fully registered icon components (941f3a4)
  • sidenav: update spectrum css input (bd43201)

0.7.0 (2021-01-13) #

Bug Fixes #

  • include the "types" entry in package.json files (b432f59)
  • prevent infinite loops when all children are disabled
  • stop merging selectors in a way that alters the cascade (369388f)
  • update latest Spectrum CSS beta releases (d8d3acc)
  • use latest @spectrum-css/* versions (c35eb86)

Features #

  • action-button: add action button pattern (03ac00a)
  • icons-workflow: vend fully registered icon components (941f3a4)
  • sidenav: update spectrum css input (bd43201)

0.6.0 (2020-11-20) #

Features #

  • support rel attribute for sidenav item (90522e7)

0.5.4 (2020-10-12) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.5.3 (2020-10-12) #

Bug Fixes #

  • include default export in the "exports" fields (f32407d)

0.5.2 (2020-09-25) #

Bug Fixes #

  • update side effect listings (8160d3a)

0.5.1 (2020-09-14) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.5.0 (2020-08-31) #

Features #

  • update to Spectrum CSS v3.0.0 (e8b3d8f)

0.4.3 (2020-08-19) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.4.2 (2020-07-27) #

Bug Fixes #

  • ensure browser understandable extensions (f4e59f7)

0.4.1 (2020-07-22) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.4.0 (2020-07-17) #

Bug Fixes #

  • sidenav: add aria-current when using href with sidenav-item (9172639)
  • sidenav: manage tabindex when interacting with keyboard (ea977cf)

Features #

  • leverage "exports" field in package.json (321abd7)

0.3.8 (2020-06-08) #

Bug Fixes #

  • sidenav: add support for icons and document icons/headlines (9ddb363)
  • sidenav: tighten Spectrum adherence and sharpen docs delivery (d4c70cd)

0.3.7 (2020-04-16) #

Performance Improvements #

  • use "sideEffects" listing in package.json (7271614)

0.3.6 (2020-04-10) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.3.5 (2020-04-07) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.3.4 (2020-03-11) #

Bug Fixes #

  • correct a11y tree (f7e54e5)

0.3.3 (2020-02-05) #

Bug Fixes #

  • correctly track "activeElement" across shadow boundaries (8b9f93a)

0.3.2 (2020-02-01) #

Note: Version bump only for package @spectrum-web-components/sidenav

0.3.1 (2020-01-30) #

Bug Fixes #

  • fix expanding sidenav item that has no value (b28cdac)

0.3.0 (2020-01-06) #

Features #

  • sidenav: add keyboard accessibility (6ff622b)

0.2.2 (2019-12-02) #

Bug Fixes #

  • normalize "event" and "error" argument names (8d382cd)

0.2.1 (2019-11-27) #

Bug Fixes #

  • include "type" in package.json, generate custom-elements.json (1a8d716)

0.2.0 (2019-11-19) #

Features #

  • use :focus-visable (via polyfill) instead of :focus (11c6fc7)
  • use @adobe/spectrum-css@2.15.1 (3918888)

0.1.4 (2019-10-14) #

Performance Improvements #

  • use imported TypeScript helpers instead of inlining them (cc2bd0a)

0.1.3 (2019-10-03) #

Note: Version bump only for package @spectrum-web-components/sidenav

Description #

Side navigation allows users to locate information and features within the UI. It can be used for either hierarchical or flat navigation, and gives the ability to group navigable items categorically. Side navigation is an opportunity to prioritize content or features based on your users’ needs in a way that maintains clear, persistent visibility. Use side navigation within the context of larger elements and mechanisms within the app frame.

<sp-sidenav> elements accept both <sp-sidenav-item> and <sp-sidenav-heading> elements as children in order to construct a hierarchy of navigation elements. <sp-sidenav-item> elements will place themselves as a togglable child of their <sp-sidenav> element parent. <sp-sidenav-heading> elements will create visible structure by grouping their child <sp-sidenav-item> children under a non-interactive heading.

Usage #

See it on NPM! How big is this package in your project? Try it on webcomponents.dev

yarn add @spectrum-web-components/sidenav

Import the side effectful registration of <sp-sidenav>, <sp-sidenav-heading>, or <sp-sidenav-item> via:

import '@spectrum-web-components/sidenav/sp-sidenav.js';
import '@spectrum-web-components/sidenav/sp-sidenav-heading.js';
import '@spectrum-web-components/sidenav/sp-sidenav-item.js';

When looking to leverage the Sidenav, SidenavHeading, or SidenavItem base classes as a type and/or for extension purposes, do so via:

import {
    Sidenav,
    SidenavHeading,
    SidenavItem
} from '@spectrum-web-components/sidenav';

Example #

<sp-sidenav defaultValue="Docs">
    <sp-sidenav-item
        value="Docs"
        href="/components/SideNav"
        label="Docs"
        selected
    ></sp-sidenav-item>
    <sp-sidenav-item
        value="Guides"
        href="/guides/getting_started"
        label="Guides"
    ></sp-sidenav-item>
    <sp-sidenav-item
        value="Community"
        href="/community"
        label="Community"
    ></sp-sidenav-item>
    <sp-sidenav-item
        value="Storybook"
        href="/storybook"
        target="_blank"
        label="Storybook"
    ></sp-sidenav-item>
    <sp-sidenav-item
        value="Releases"
        href="http://git.corp.adobe.com/React/react-spectrum/releases"
        target="_blank"
        label="Releases"
        disabled
    ></sp-sidenav-item>
    <sp-sidenav-item
        value="GitHub"
        href="http://git.corp.adobe.com/React/react-spectrum"
        target="_blank"
        label="Github"
    ></sp-sidenav-item>
</sp-sidenav>

Multi-level #

Use this variation when you have multiple layers of hierarchical navigation. The headers are styled differently and possess the same interactive behavior as a treeview; clicking the header opens and collapses the children navigation items. In the instances where a top-level navigation item has no children, clicking will send the user to the location of the item.

<sp-sidenav variant="multilevel" defaultValue="Layout">
    <sp-sidenav-item value="Guidelines" label="Guidelines">
    </sp-sidenav-item>
    <sp-sidenav-item value="Styles" label="Styles" expanded>
        <sp-sidenav-item value="Color" label="Color">
        </sp-sidenav-item>
        <sp-sidenav-item value="Grid" label="Grid" expanded>
            <sp-sidenav-item value="Layout" label="Layout">
            </sp-sidenav-item>
            <sp-sidenav-item value="Responsive" label="Responsive">
            </sp-sidenav-item>
        </sp-sidenav-item>
        <sp-sidenav-item value="Typography" label="Typography">
        </sp-sidenav-item>
    </sp-sidenav-item>
    <sp-sidenav-item value="Elements" label="Elements">
    </sp-sidenav-item>
    <sp-sidenav-item value="Patterns" label="Patterns">
    </sp-sidenav-item>
</sp-sidenav-itm>

Icon #

<sp-sidenav>
    <sp-sidenav-item value="Section Title 1" label="Section Title 1">
        <sp-icon-star slot="icon"></sp-icon-star>
    </sp-sidenav-item>
    <sp-sidenav-item value="Section Title 2" label="Section Title 2">
        <sp-icon-star slot="icon"></sp-icon-star>
    </sp-sidenav-item>
    <sp-sidenav-item value="Section Title 3" label="Section Title 3">
        <sp-icon-star slot="icon"></sp-icon-star>
    </sp-sidenav-item>
</sp-sidenav>

Heading #

<sp-sidenav variant="multilevel">
    <sp-sidenav-item value="Section 1" label="Section 1"></sp-sidenav-item>
    <sp-sidenav-item value="Section 2" label="Section 2"></sp-sidenav-item>
    <sp-sidenav-heading label="Category 1">
        <sp-sidenav-item value="Section 3" label="Section 3"></sp-sidenav-item>
        <sp-sidenav-item value="Section 4" label="Section 4"></sp-sidenav-item>
    </sp-sidenav-heading>
    <sp-sidenav-heading label="Category 2">
        <sp-sidenav-item value="Section 5" label="Section 5"></sp-sidenav-item>
        <sp-sidenav-item value="Section 6" label="Section 6"></sp-sidenav-item>
    </sp-sidenav-heading>
</sp-sidenav>

Accessibility #

When the manage-tab-index attribute is set on an sp-sidenav element then it will presents its child sp-sidenav-item children with a single tab-stop. This will leave items beyond the selected item, or first when there is no focusable selected item, will be accessibile via the up and down arrow keys.