Skip to main content
Light Dark System

Primary Navigation Menu

<cw-primary-navigation-menu> | CwPrimaryNavigationMenu
Since 1.3 experimental

A simple flat list of links shown in a <cw-primary-navigation-item>’s dropdown. Deliberately minimal — no headings, grouping, multi-column layout, or promo slot; styles plain <a> elements only.

Slot plain <a> elements in — this component only provides positioning and styling, deliberately with no headings, grouping, or multi-column layout.

Products Shoes Boots Sandals
<cw-primary-navigation>
  <cw-primary-navigation-item>
    Products
    <cw-primary-navigation-menu slot="menu">
      <a href="/">Shoes</a>
      <a href="/">Boots</a>
      <a href="/">Sandals</a>
    </cw-primary-navigation-menu>
  </cw-primary-navigation-item>
</cw-primary-navigation>
import { CwPrimaryNavigation, CwPrimaryNavigationItem, CwPrimaryNavigationMenu } from '@cordwainer/cw-elements/dist/react';

const App = () => (
  <CwPrimaryNavigation>
    <CwPrimaryNavigationItem>
      Products
      <CwPrimaryNavigationMenu slot="menu">
        <a href="/">Shoes</a>
        <a href="/">Boots</a>
        <a href="/">Sandals</a>
      </CwPrimaryNavigationMenu>
    </CwPrimaryNavigationItem>
  </CwPrimaryNavigation>
);

Importing

If you’re using the autoloader or the traditional loader, you can ignore this section. Otherwise, feel free to use any of the following snippets to cherry pick this component.

Script Import Bundler React

To import this component from the CDN using a script tag:

<script type="module" src="https://cdn.jsdelivr.net/npm/@cordwainer/cw-elements@1.5.2/cdn/components/primary-navigation-menu/primary-navigation-menu.js"></script>

To import this component from the CDN using a JavaScript import:

import 'https://cdn.jsdelivr.net/npm/@cordwainer/cw-elements@1.5.2/cdn/components/primary-navigation-menu/primary-navigation-menu.js';

To import this component using a bundler:

import '@cordwainer/cw-elements/dist/components/primary-navigation-menu/primary-navigation-menu.js';

To import this component as a React component:

import CwPrimaryNavigationMenu from '@cordwainer/cw-elements/dist/react/primary-navigation-menu';

Slots

Name Description
(default) One or more plain <a> elements.

Learn more about using slots.

Properties

Name Description Reflects Type Default
mobile Set automatically by the parent <cw-primary-navigation-item> when its own dropdown is rendered inline for a mobile hamburger menu rather than as a floating panel — swaps the card-like floating appearance (border, shadow, fixed minimum width) for a full-width, unbordered look that matches the rest of the mobile menu. Not intended to be set directly. boolean false
updateComplete A read-only promise that resolves when the component has finished updating.

Learn more about attributes and properties.

Parts

Name Description
base The component’s base wrapper.

Learn more about customizing CSS parts.