Skip to content

Navigation Menu ​

A collection of links and menus for website navigation.

vue
<script setup lang="ts">
import { h } from 'vue';
import type { FunctionalComponent } from 'vue';
import { NavigationMenu } from '@vase-ui/vue/navigation-menu';
import styles from './index.module.css';

const transition = { enterFromClass: styles.EnterFrom, leaveToClass: styles.LeaveTo };

const CaretDownIcon: FunctionalComponent = () =>
  h(
    'svg',
    {
      width: '16',
      height: '16',
      viewBox: '0 0 16 16',
      fill: 'currentColor',
      style: { display: 'block' },
    },
    [h('path', { d: 'M12 6H4l4 4.5z' })],
  );

const base = import.meta.env.BASE_URL;

const overviewLinks = [
  {
    href: `${base}quick-start`,
    title: 'Quick Start',
    description: 'Install and assemble your first component.',
  },
  {
    href: `${base}parity`,
    title: 'Parity',
    description: 'See which components are complete and which are not started.',
  },
  {
    href: `${base}thanks`,
    title: 'Thanks',
    description: 'Meet the people whose work Vase UI carries.',
  },
  {
    href: base,
    title: 'About',
    description: 'Learn more about Vase UI and why it exists.',
  },
] as const;

const handbookLinks = [
  {
    href: `${base}handbook/styling`,
    title: 'Styling',
    description:
      'Vase UI components can be styled with plain CSS, CSS Modules, or utility classes.',
  },
  {
    href: `${base}handbook/animation`,
    title: 'Animation',
    description:
      'Vase UI components can be animated with CSS transitions, CSS animations, or JavaScript.',
  },
  {
    href: `${base}handbook/composition`,
    title: 'Composition',
    description: 'Vase UI components can be replaced and composed with your own components.',
  },
] as const;
</script>

<template>
  <NavigationMenu.Root :class="styles.Root" aria-label="Example">
    <NavigationMenu.List :class="styles.List">
      <NavigationMenu.Item>
        <NavigationMenu.Trigger :class="styles.Trigger">
          Overview
          <NavigationMenu.Icon :class="styles.Icon">
            <CaretDownIcon />
          </NavigationMenu.Icon>
        </NavigationMenu.Trigger>
        <NavigationMenu.Content :class="styles.Content" :transition="transition">
          <ul :class="styles.GridLinkList">
            <li v-for="item in overviewLinks" :key="item.href">
              <!-- For the link of a router, see the custom links of the docs. -->
              <NavigationMenu.Link :class="styles.LinkCard" :href="item.href">
                <h3 :class="styles.LinkTitle">{{ item.title }}</h3>
                <p :class="styles.LinkDescription">{{ item.description }}</p>
              </NavigationMenu.Link>
            </li>
          </ul>
        </NavigationMenu.Content>
      </NavigationMenu.Item>

      <NavigationMenu.Item>
        <NavigationMenu.Trigger :class="styles.Trigger">
          Handbook
          <NavigationMenu.Icon :class="styles.Icon">
            <CaretDownIcon />
          </NavigationMenu.Icon>
        </NavigationMenu.Trigger>
        <NavigationMenu.Content :class="styles.Content" :transition="transition">
          <ul :class="styles.FlexLinkList">
            <li v-for="item in handbookLinks" :key="item.href">
              <NavigationMenu.Link :class="styles.LinkCard" :href="item.href">
                <h3 :class="styles.LinkTitle">{{ item.title }}</h3>
                <p :class="styles.LinkDescription">{{ item.description }}</p>
              </NavigationMenu.Link>
            </li>
          </ul>
        </NavigationMenu.Content>
      </NavigationMenu.Item>

      <NavigationMenu.Item>
        <NavigationMenu.Link :class="styles.Trigger" href="https://github.com/vase-ui/vase-ui">
          GitHub
        </NavigationMenu.Link>
      </NavigationMenu.Item>
    </NavigationMenu.List>

    <NavigationMenu.Portal>
      <NavigationMenu.Positioner
        :class="styles.Positioner"
        :side-offset="10"
        :collision-padding="{ top: 5, bottom: 5, left: 20, right: 20 }"
        :collision-avoidance="{ side: 'none' }"
      >
        <Transition :enter-from-class="styles.EnterFrom" :leave-to-class="styles.LeaveTo" appear>
          <NavigationMenu.Popup :class="styles.Popup">
            <NavigationMenu.Arrow :class="styles.Arrow" />
            <NavigationMenu.Viewport :class="styles.Viewport" />
          </NavigationMenu.Popup>
        </Transition>
      </NavigationMenu.Positioner>
    </NavigationMenu.Portal>
  </NavigationMenu.Root>
</template>
css
.Root {
  box-sizing: border-box;
  color: oklch(14.5% 0 0deg);
  min-width: max-content;

  @media (prefers-color-scheme: dark) {
    color: white;
  }
}

.List {
  display: flex;
  position: relative;
  gap: 1px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.Trigger {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  height: 2rem;
  padding: 0 0.75rem;
  margin: 0;
  outline: 0;
  border: 0;
  background-color: transparent;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.25rem;
  color: oklch(14.5% 0 0deg);
  -webkit-user-select: none;
  user-select: none;
  text-decoration: none;

  @media (max-width: 500px) {
    padding: 0 0.5rem;
  }

  @media (prefers-color-scheme: dark) {
    color: white;
  }

  @media (hover: hover) {
    &:hover {
      background-color: oklch(97% 0 0deg);

      @media (prefers-color-scheme: dark) {
        background-color: oklch(26.9% 0 0deg);
      }
    }
  }

  &[aria-expanded='true'] {
    background-color: oklch(97% 0 0deg);

    @media (prefers-color-scheme: dark) {
      background-color: oklch(26.9% 0 0deg);
    }
  }

  &:focus-visible {
    outline: 2px solid oklch(14.5% 0 0deg);
    outline-offset: -1px;

    @media (prefers-color-scheme: dark) {
      outline-color: white;
    }
  }
}

.Icon {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;

  &[data-popup-open] {
    transform: rotate(180deg);
  }
}

.Positioner {
  --easing: cubic-bezier(0.22, 1, 0.36, 1);
  --duration: 0.35s;
  box-sizing: border-box;
  transition-property: top, left, right, bottom;
  transition-duration: var(--duration);
  transition-timing-function: var(--easing);
  width: var(--positioner-width);
  height: var(--positioner-height);
  max-width: var(--available-width);

  &::before {
    content: '';
    position: absolute;
  }

  &[data-side='top']::before {
    left: 0;
    right: 0;
    bottom: -10px;
    height: 10px;
  }

  &[data-side='bottom']::before {
    left: 0;
    right: 0;
    top: -10px;
    height: 10px;
  }

  &[data-side='left']::before {
    top: 0;
    bottom: 0;
    right: -10px;
    width: 10px;
  }

  &[data-side='right']::before {
    top: 0;
    bottom: 0;
    left: -10px;
    width: 10px;
  }

  &[data-instant] {
    transition: none;
  }
}

.Popup {
  position: relative;
  overflow: visible;
  box-sizing: border-box;
  outline: 0;
  border: 1px solid oklch(14.5% 0 0deg);
  background-color: white;
  color: oklch(14.5% 0 0deg);
  box-shadow: 0.25rem 0.25rem 0 rgb(0 0 0 / 12%);
  transform-origin: var(--transform-origin);
  transition-property: opacity, transform, width, height;
  transition-duration: var(--duration);
  transition-timing-function: var(--easing);
  width: var(--popup-width);
  height: var(--popup-height);

  @media (prefers-color-scheme: dark) {
    border: 1px solid white;
    background-color: oklch(14.5% 0 0deg);
    color: white;
    box-shadow: none;
  }

  &.EnterFrom,
  &.LeaveTo {
    opacity: 0;
    transform: scale(0.9);
  }

  &.LeaveTo {
    transition-timing-function: ease;
    transition-duration: 0.15s;
  }
}

.Content {
  box-sizing: border-box;
  transition:
    opacity calc(var(--duration) * 0.5) ease,
    transform var(--duration) var(--easing);
  padding: 0.5rem;
  width: calc(100vw - 40px);
  height: 100%;

  @media (min-width: 500px) {
    width: max-content;
    max-width: 400px;
  }

  &.EnterFrom,
  &.LeaveTo {
    opacity: 0;
  }

  &.EnterFrom {
    &[data-activation-direction='left'] {
      transform: translateX(-50%);
    }
    &[data-activation-direction='right'] {
      transform: translateX(50%);
    }
  }

  &.LeaveTo {
    &[data-activation-direction='left'] {
      transform: translateX(50%);
    }
    &[data-activation-direction='right'] {
      transform: translateX(-50%);
    }
  }
}

.Viewport {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 100%;
}

.GridLinkList {
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 1fr 1fr;
  list-style: none;
  padding: 0;
  margin: 0;

  @media (max-width: 500px) {
    grid-template-columns: 1fr;
  }
}

.FlexLinkList {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 400px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.LinkCard {
  box-sizing: border-box;
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0.5rem;
  text-decoration: none;
  color: inherit;
  text-align: left;
  border: 0;
  background-color: transparent;

  @media (hover: hover) {
    &:hover {
      background-color: oklch(97% 0 0deg);

      @media (prefers-color-scheme: dark) {
        background-color: oklch(26.9% 0 0deg);
      }
    }
  }

  &:focus-visible {
    outline: 2px solid oklch(14.5% 0 0deg);
    outline-offset: -1px;

    @media (prefers-color-scheme: dark) {
      outline-color: white;
    }
  }
}

.LinkTitle {
  margin: 0 0 4px;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1rem;
}

.LinkDescription {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: oklch(55.6% 0 0deg);

  @media (prefers-color-scheme: dark) {
    color: oklch(70.8% 0 0deg);
  }
}

.Arrow {
  display: block;
  position: relative;
  width: 12px;
  height: 6px;
  overflow: clip;
  transition:
    left var(--duration) var(--easing),
    right var(--duration) var(--easing);

  &[data-side='top'] {
    bottom: -6px;
    rotate: 180deg;
  }

  &[data-side='bottom'] {
    top: -6px;
    rotate: 0deg;
  }

  &[data-side='left'] {
    right: -9px;
    rotate: 90deg;
  }

  &[data-side='right'] {
    left: -9px;
    rotate: -90deg;
  }

  &::before {
    content: '';
    display: block;
    position: absolute;
    bottom: 0;
    left: 50%;
    box-sizing: border-box;
    width: calc(6px * sqrt(2));
    height: calc(6px * sqrt(2));
    border: 1px solid oklch(14.5% 0 0deg);
    background-color: white;
    transform: translate(-50%, 50%) rotate(45deg);

    @media (prefers-color-scheme: dark) {
      border: 1px solid white;
      background-color: oklch(14.5% 0 0deg);
    }
  }
}
vue
<script setup lang="ts">
import { h } from 'vue';
import type { FunctionalComponent } from 'vue';
import { NavigationMenu } from '@vase-ui/vue/navigation-menu';

const CaretDownIcon: FunctionalComponent = () =>
  h(
    'svg',
    {
      width: '16',
      height: '16',
      viewBox: '0 0 16 16',
      fill: 'currentColor',
      style: { display: 'block' },
    },
    [h('path', { d: 'M12 6H4l4 4.5z' })],
  );

const base = import.meta.env.BASE_URL;

const overviewLinks = [
  {
    href: `${base}quick-start`,
    title: 'Quick Start',
    description: 'Install and assemble your first component.',
  },
  {
    href: `${base}parity`,
    title: 'Parity',
    description: 'See which components are complete and which are not started.',
  },
  {
    href: `${base}thanks`,
    title: 'Thanks',
    description: 'Meet the people whose work Vase UI carries.',
  },
  {
    href: base,
    title: 'About',
    description: 'Learn more about Vase UI and why it exists.',
  },
] as const;

const handbookLinks = [
  {
    href: `${base}handbook/styling`,
    title: 'Styling',
    description:
      'Vase UI components can be styled with plain CSS, CSS Modules, or utility classes.',
  },
  {
    href: `${base}handbook/animation`,
    title: 'Animation',
    description:
      'Vase UI components can be animated with CSS transitions, CSS animations, or JavaScript.',
  },
  {
    href: `${base}handbook/composition`,
    title: 'Composition',
    description: 'Vase UI components can be replaced and composed with your own components.',
  },
] as const;

const triggerClassName =
  'flex h-8 items-center justify-center gap-1.5 bg-transparent px-2 text-sm font-normal text-neutral-950 no-underline select-none min-[501px]:px-3 hover:bg-neutral-100 aria-expanded:bg-neutral-100 focus-visible:outline-2 focus-visible:-outline-offset-1 focus-visible:outline-neutral-950 dark:focus-visible:outline-white dark:text-white dark:hover:bg-neutral-800 dark:aria-expanded:bg-neutral-800';
const contentClassName =
  'h-full w-[calc(100vw-40px)] p-2 min-[500px]:w-max min-[500px]:max-w-[400px] ' +
  'transition-[opacity,transform,translate] duration-[var(--duration)] ease-[var(--easing)]';
const contentTransition = {
  enterFromClass:
    'opacity-0 data-[activation-direction=left]:translate-x-[-50%] data-[activation-direction=right]:translate-x-[50%]',
  leaveToClass:
    'opacity-0 data-[activation-direction=left]:translate-x-[50%] data-[activation-direction=right]:translate-x-[-50%]',
};
const linkCardClassName =
  'relative block h-full w-full border-0 bg-transparent p-2 text-left text-inherit no-underline hover:bg-neutral-100 focus-visible:outline-2 focus-visible:-outline-offset-1 focus-visible:outline-neutral-950 dark:focus-visible:outline-white dark:hover:bg-neutral-800';
</script>

<template>
  <NavigationMenu.Root class="min-w-max text-neutral-950 dark:text-white" aria-label="Example">
    <NavigationMenu.List class="relative flex gap-px">
      <NavigationMenu.Item>
        <NavigationMenu.Trigger :class="triggerClassName">
          Overview
          <NavigationMenu.Icon
            class="transition-transform duration-200 ease-[ease] data-popup-open:rotate-180"
          >
            <CaretDownIcon />
          </NavigationMenu.Icon>
        </NavigationMenu.Trigger>
        <NavigationMenu.Content :class="contentClassName" :transition="contentTransition">
          <ul class="m-0 grid list-none grid-cols-2 p-0 max-[500px]:grid-cols-1">
            <li v-for="item in overviewLinks" :key="item.href">
              <!-- For the link of a router, see the custom links of the docs. -->
              <NavigationMenu.Link :class="linkCardClassName" :href="item.href">
                <h3 class="m-0 mb-1 text-sm leading-4 font-normal">{{ item.title }}</h3>
                <p class="m-0 text-sm text-neutral-500 dark:text-neutral-400">
                  {{ item.description }}
                </p>
              </NavigationMenu.Link>
            </li>
          </ul>
        </NavigationMenu.Content>
      </NavigationMenu.Item>

      <NavigationMenu.Item>
        <NavigationMenu.Trigger :class="triggerClassName">
          Handbook
          <NavigationMenu.Icon
            class="transition-transform duration-200 ease-[ease] data-popup-open:rotate-180"
          >
            <CaretDownIcon />
          </NavigationMenu.Icon>
        </NavigationMenu.Trigger>
        <NavigationMenu.Content :class="contentClassName" :transition="contentTransition">
          <ul class="m-0 flex max-w-[400px] list-none flex-col justify-center p-0">
            <li v-for="item in handbookLinks" :key="item.href">
              <NavigationMenu.Link :class="linkCardClassName" :href="item.href">
                <h3 class="m-0 mb-1 text-sm leading-4 font-normal">{{ item.title }}</h3>
                <p class="m-0 text-sm text-neutral-500 dark:text-neutral-400">
                  {{ item.description }}
                </p>
              </NavigationMenu.Link>
            </li>
          </ul>
        </NavigationMenu.Content>
      </NavigationMenu.Item>

      <NavigationMenu.Item>
        <NavigationMenu.Link :class="triggerClassName" href="https://github.com/vase-ui/vase-ui">
          GitHub
        </NavigationMenu.Link>
      </NavigationMenu.Item>
    </NavigationMenu.List>

    <NavigationMenu.Portal>
      <NavigationMenu.Positioner
        class="h-[var(--positioner-height)] w-[var(--positioner-width)] max-w-[var(--available-width)] transition-[top,left,right,bottom] duration-[var(--duration)] ease-[var(--easing)] before:absolute before:content-[''] data-instant:transition-none data-[side=bottom]:before:top-[-10px] data-[side=bottom]:before:right-0 data-[side=bottom]:before:left-0 data-[side=bottom]:before:h-2.5 data-[side=left]:before:top-0 data-[side=left]:before:right-[-10px] data-[side=left]:before:bottom-0 data-[side=left]:before:w-2.5 data-[side=right]:before:top-0 data-[side=right]:before:bottom-0 data-[side=right]:before:left-[-10px] data-[side=right]:before:w-2.5 data-[side=top]:before:right-0 data-[side=top]:before:bottom-[-10px] data-[side=top]:before:left-0 data-[side=top]:before:h-2.5"
        :side-offset="10"
        :collision-padding="{ top: 5, bottom: 5, left: 20, right: 20 }"
        :collision-avoidance="{ side: 'none' }"
        :style="{ '--duration': '0.35s', '--easing': 'cubic-bezier(0.22, 1, 0.36, 1)' }"
      >
        <Transition
          enter-from-class="scale-90 opacity-0"
          leave-to-class="scale-90 opacity-0 duration-150 ease-[ease]"
          appear
        >
          <NavigationMenu.Popup
            class="relative h-[var(--popup-height)] w-[var(--popup-width)] origin-[var(--transform-origin)] border border-neutral-950 bg-white text-neutral-950 shadow-[0.25rem_0.25rem_0] shadow-black/12 outline-none transition-[opacity,transform,width,height,scale] duration-[var(--duration)] ease-[var(--easing)] dark:border-white dark:bg-neutral-950 dark:text-white dark:shadow-none"
          >
            <NavigationMenu.Arrow
              class="relative block h-1.5 w-3 overflow-clip transition-[left,right] duration-[var(--duration)] ease-[var(--easing)] before:absolute before:bottom-0 before:left-1/2 before:block before:h-[calc(6px*sqrt(2))] before:w-[calc(6px*sqrt(2))] before:-translate-x-1/2 before:translate-y-1/2 before:rotate-45 before:border before:border-neutral-950 before:bg-white before:content-[''] data-[side=bottom]:top-[-6px] data-[side=left]:right-[-9px] data-[side=left]:rotate-90 data-[side=right]:left-[-9px] data-[side=right]:-rotate-90 data-[side=top]:bottom-[-6px] data-[side=top]:rotate-180 dark:before:border-white dark:before:bg-neutral-950"
            />
            <NavigationMenu.Viewport class="relative h-full w-full overflow-hidden" />
          </NavigationMenu.Popup>
        </Transition>
      </NavigationMenu.Positioner>
    </NavigationMenu.Portal>
  </NavigationMenu.Root>
</template>

Anatomy ​

Import the component and assemble its parts:

vue
<script setup lang="ts">
import { NavigationMenu } from '@vase-ui/vue/navigation-menu';
</script>

<template>
  <NavigationMenu.Root>
    <NavigationMenu.List>
      <NavigationMenu.Item>
        <NavigationMenu.Trigger>
          <NavigationMenu.Icon />
        </NavigationMenu.Trigger>
        <NavigationMenu.Content :transition="{ name: 'slide' }">
          <NavigationMenu.Link />
        </NavigationMenu.Content>
      </NavigationMenu.Item>
    </NavigationMenu.List>

    <NavigationMenu.Portal>
      <Transition appear>
        <NavigationMenu.Backdrop />
      </Transition>
      <NavigationMenu.Positioner>
        <Transition appear>
          <NavigationMenu.Popup>
            <NavigationMenu.Arrow />
            <NavigationMenu.Viewport />
          </NavigationMenu.Popup>
        </Transition>
      </NavigationMenu.Positioner>
    </NavigationMenu.Portal>
  </NavigationMenu.Root>
</template>

Examples ​

Nested submenus ​

Put a NavigationMenu.Root in a NavigationMenu.Content to make a menu with more than one level.

vue
<script setup lang="ts">
import { h } from 'vue';
import type { FunctionalComponent } from 'vue';
import { NavigationMenu } from '@vase-ui/vue/navigation-menu';
import styles from './index.module.css';

const transition = { enterFromClass: styles.EnterFrom, leaveToClass: styles.LeaveTo };

const CaretDownIcon: FunctionalComponent = () =>
  h(
    'svg',
    {
      width: '16',
      height: '16',
      viewBox: '0 0 16 16',
      fill: 'currentColor',
      style: { display: 'block' },
    },
    [h('path', { d: 'M12 6H4l4 4.5z' })],
  );

const CaretRightIcon: FunctionalComponent = () =>
  h(
    'svg',
    {
      width: '16',
      height: '16',
      viewBox: '0 0 16 16',
      fill: 'currentColor',
      style: { display: 'block' },
    },
    [h('path', { d: 'M6 12V4l4.5 4z' })],
  );

const base = import.meta.env.BASE_URL;

const overviewLinks = [
  {
    href: `${base}quick-start`,
    title: 'Quick Start',
    description: 'Install and assemble your first component.',
  },
  {
    href: `${base}parity`,
    title: 'Parity',
    description: 'See which components are complete and which are not started.',
  },
  {
    href: `${base}thanks`,
    title: 'Thanks',
    description: 'Meet the people whose work Vase UI carries.',
  },
] as const;

const handbookLinks = [
  {
    href: `${base}handbook/styling`,
    title: 'Styling',
    description:
      'Vase UI components can be styled with plain CSS, CSS Modules, or utility classes.',
  },
  {
    href: `${base}handbook/animation`,
    title: 'Animation',
    description:
      'Vase UI components can be animated with CSS transitions, CSS animations, or JavaScript.',
  },
  {
    href: `${base}handbook/composition`,
    title: 'Composition',
    description: 'Vase UI components can be replaced and composed with your own components.',
  },
] as const;
</script>

<template>
  <NavigationMenu.Root :class="styles.Root" aria-label="Nested submenus">
    <NavigationMenu.List :class="styles.List">
      <NavigationMenu.Item>
        <NavigationMenu.Trigger :class="styles.Trigger">
          Overview
          <NavigationMenu.Icon :class="styles.Icon">
            <CaretDownIcon />
          </NavigationMenu.Icon>
        </NavigationMenu.Trigger>
        <NavigationMenu.Content :class="styles.Content" :transition="transition">
          <ul :class="styles.GridLinkList">
            <li v-for="item in overviewLinks" :key="item.href">
              <!-- For the link of a router, see the custom links of the docs. -->
              <NavigationMenu.Link :class="styles.LinkCard" :href="item.href">
                <h3 :class="styles.LinkTitle">{{ item.title }}</h3>
                <p :class="styles.LinkDescription">{{ item.description }}</p>
              </NavigationMenu.Link>
            </li>
            <li>
              <NavigationMenu.Root orientation="vertical">
                <NavigationMenu.List>
                  <NavigationMenu.Item>
                    <NavigationMenu.Trigger :class="styles.LinkCard">
                      <span :class="styles.LinkTitle">Handbook</span>
                      <p :class="styles.LinkDescription">How to use Vase UI effectively.</p>
                      <NavigationMenu.Icon :class="styles.NestedIcon">
                        <CaretRightIcon />
                      </NavigationMenu.Icon>
                    </NavigationMenu.Trigger>
                    <NavigationMenu.Content :class="styles.Content" :transition="transition">
                      <ul :class="styles.FlexLinkList">
                        <li v-for="item in handbookLinks" :key="item.href">
                          <NavigationMenu.Link :class="styles.LinkCard" :href="item.href">
                            <h3 :class="styles.LinkTitle">{{ item.title }}</h3>
                            <p :class="styles.LinkDescription">{{ item.description }}</p>
                          </NavigationMenu.Link>
                        </li>
                      </ul>
                    </NavigationMenu.Content>
                  </NavigationMenu.Item>
                </NavigationMenu.List>

                <NavigationMenu.Portal>
                  <NavigationMenu.Positioner
                    :class="styles.Positioner"
                    :side-offset="8"
                    :align-offset="-8"
                    align="end"
                    side="right"
                  >
                    <Transition
                      :enter-from-class="styles.EnterFrom"
                      :leave-to-class="styles.LeaveTo"
                      appear
                    >
                      <NavigationMenu.Popup :class="styles.Popup">
                        <NavigationMenu.Viewport :class="styles.Viewport" />
                      </NavigationMenu.Popup>
                    </Transition>
                  </NavigationMenu.Positioner>
                </NavigationMenu.Portal>
              </NavigationMenu.Root>
            </li>
          </ul>
        </NavigationMenu.Content>
      </NavigationMenu.Item>
    </NavigationMenu.List>

    <NavigationMenu.Portal>
      <NavigationMenu.Positioner
        :class="styles.Positioner"
        :side-offset="10"
        :collision-padding="{ top: 5, bottom: 5, left: 20, right: 20 }"
      >
        <Transition :enter-from-class="styles.EnterFrom" :leave-to-class="styles.LeaveTo" appear>
          <NavigationMenu.Popup :class="styles.Popup">
            <NavigationMenu.Arrow :class="styles.Arrow" />
            <NavigationMenu.Viewport :class="styles.Viewport" />
          </NavigationMenu.Popup>
        </Transition>
      </NavigationMenu.Positioner>
    </NavigationMenu.Portal>
  </NavigationMenu.Root>
</template>
css
.Root {
  box-sizing: border-box;
  color: oklch(14.5% 0 0deg);
  min-width: max-content;

  @media (prefers-color-scheme: dark) {
    color: white;
  }
}

.List {
  display: flex;
  position: relative;
  gap: 1px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.Trigger {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  height: 2rem;
  padding: 0 0.75rem;
  margin: 0;
  outline: 0;
  border: 0;
  background-color: transparent;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.25rem;
  color: oklch(14.5% 0 0deg);
  -webkit-user-select: none;
  user-select: none;
  text-decoration: none;

  @media (max-width: 500px) {
    padding: 0 0.5rem;
  }

  @media (prefers-color-scheme: dark) {
    color: white;
  }

  @media (hover: hover) {
    &:hover {
      background-color: oklch(97% 0 0deg);

      @media (prefers-color-scheme: dark) {
        background-color: oklch(26.9% 0 0deg);
      }
    }
  }

  &[aria-expanded='true'] {
    background-color: oklch(97% 0 0deg);

    @media (prefers-color-scheme: dark) {
      background-color: oklch(26.9% 0 0deg);
    }
  }

  &:focus-visible {
    outline: 2px solid oklch(14.5% 0 0deg);
    outline-offset: -1px;

    @media (prefers-color-scheme: dark) {
      outline-color: white;
    }
  }
}

.Icon {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;

  &[data-popup-open] {
    transform: rotate(180deg);
  }
}

.Positioner {
  --easing: cubic-bezier(0.22, 1, 0.36, 1);
  --duration: 0.35s;
  box-sizing: border-box;
  transition-property: top, left, right, bottom;
  transition-duration: var(--duration);
  transition-timing-function: var(--easing);
  width: var(--positioner-width);
  height: var(--positioner-height);
  max-width: var(--available-width);

  &::before {
    content: '';
    position: absolute;
  }

  &[data-side='top']::before {
    left: 0;
    right: 0;
    bottom: -10px;
    height: 10px;
  }

  &[data-side='bottom']::before {
    left: 0;
    right: 0;
    top: -10px;
    height: 10px;
  }

  &[data-side='left']::before {
    top: 0;
    bottom: 0;
    right: -10px;
    width: 10px;
  }

  &[data-side='right']::before {
    top: 0;
    bottom: 0;
    left: -10px;
    width: 10px;
  }

  &[data-instant] {
    transition: none;
  }
}

.Popup {
  position: relative;
  overflow: visible;
  box-sizing: border-box;
  outline: 0;
  border: 1px solid oklch(14.5% 0 0deg);
  background-color: white;
  color: oklch(14.5% 0 0deg);
  box-shadow: 0.25rem 0.25rem 0 rgb(0 0 0 / 12%);
  transform-origin: var(--transform-origin);
  transition-property: opacity, transform, width, height;
  transition-duration: var(--duration);
  transition-timing-function: var(--easing);
  width: var(--popup-width);
  height: var(--popup-height);

  @media (prefers-color-scheme: dark) {
    border: 1px solid white;
    background-color: oklch(14.5% 0 0deg);
    color: white;
    box-shadow: none;
  }

  &.EnterFrom,
  &.LeaveTo {
    opacity: 0;
    transform: scale(0.9);
  }

  &.LeaveTo {
    transition-timing-function: ease;
    transition-duration: 0.15s;
  }
}

.Content {
  box-sizing: border-box;
  transition:
    opacity calc(var(--duration) * 0.5) ease,
    transform var(--duration) var(--easing);
  padding: 0.5rem;
  width: calc(100vw - 40px);
  height: 100%;

  @media (min-width: 500px) {
    width: max-content;
    min-width: 400px;
  }

  &.EnterFrom,
  &.LeaveTo {
    opacity: 0;
  }

  &.EnterFrom {
    &[data-activation-direction='left'] {
      transform: translateX(-50%);
    }
    &[data-activation-direction='right'] {
      transform: translateX(50%);
    }
  }

  &.LeaveTo {
    &[data-activation-direction='left'] {
      transform: translateX(50%);
    }
    &[data-activation-direction='right'] {
      transform: translateX(-50%);
    }
  }
}

.Viewport {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 100%;
}

.GridLinkList {
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 0;
  margin: 0;
  list-style: none;

  @media (min-width: 640px) {
    grid-template-columns: 12rem 12rem;
  }
}

.FlexLinkList {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 400px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.LinkCard {
  box-sizing: border-box;
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0.5rem;
  text-decoration: none;
  color: inherit;
  text-align: left;
  border: 0;
  background-color: transparent;

  &:active {
    background-color: oklch(97% 0 0deg);

    @media (prefers-color-scheme: dark) {
      background-color: oklch(26.9% 0 0deg);
    }
  }

  @media (hover: hover) {
    &:hover {
      background-color: oklch(97% 0 0deg);

      @media (prefers-color-scheme: dark) {
        background-color: oklch(26.9% 0 0deg);
      }
    }
  }

  &:focus-visible {
    outline: 2px solid oklch(14.5% 0 0deg);
    outline-offset: -1px;

    @media (prefers-color-scheme: dark) {
      outline-color: white;
    }
  }
}

.LinkTitle {
  margin: 0 0 4px;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1rem;
}

.LinkDescription {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: oklch(55.6% 0 0deg);

  @media (prefers-color-scheme: dark) {
    color: oklch(70.8% 0 0deg);
  }
}

.Arrow {
  display: block;
  position: relative;
  width: 12px;
  height: 6px;
  overflow: clip;
  transition:
    left var(--duration) var(--easing),
    right var(--duration) var(--easing);

  &[data-side='top'] {
    bottom: -6px;
    rotate: 180deg;
  }

  &[data-side='bottom'] {
    top: -6px;
    rotate: 0deg;
  }

  &[data-side='left'] {
    right: -9px;
    rotate: 90deg;
  }

  &[data-side='right'] {
    left: -9px;
    rotate: -90deg;
  }

  &::before {
    content: '';
    display: block;
    position: absolute;
    bottom: 0;
    left: 50%;
    box-sizing: border-box;
    width: calc(6px * sqrt(2));
    height: calc(6px * sqrt(2));
    border: 1px solid oklch(14.5% 0 0deg);
    background-color: white;
    transform: translate(-50%, 50%) rotate(45deg);

    @media (prefers-color-scheme: dark) {
      border: 1px solid white;
      background-color: oklch(14.5% 0 0deg);
    }
  }
}

.NestedIcon {
  position: absolute;
  top: 50%;
  right: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -0.3rem;
  transition: transform 0.2s ease;

  &[data-popup-open] {
    transform: rotate(180deg);
  }
}
vue
<script setup lang="ts">
import { h } from 'vue';
import type { FunctionalComponent } from 'vue';
import { NavigationMenu } from '@vase-ui/vue/navigation-menu';

const CaretDownIcon: FunctionalComponent = () =>
  h(
    'svg',
    {
      width: '16',
      height: '16',
      viewBox: '0 0 16 16',
      fill: 'currentColor',
      style: { display: 'block' },
    },
    [h('path', { d: 'M12 6H4l4 4.5z' })],
  );

const CaretRightIcon: FunctionalComponent = () =>
  h(
    'svg',
    {
      width: '16',
      height: '16',
      viewBox: '0 0 16 16',
      fill: 'currentColor',
      style: { display: 'block' },
    },
    [h('path', { d: 'M6 12V4l4.5 4z' })],
  );

const base = import.meta.env.BASE_URL;

const overviewLinks = [
  {
    href: `${base}quick-start`,
    title: 'Quick Start',
    description: 'Install and assemble your first component.',
  },
  {
    href: `${base}parity`,
    title: 'Parity',
    description: 'See which components are complete and which are not started.',
  },
  {
    href: `${base}thanks`,
    title: 'Thanks',
    description: 'Meet the people whose work Vase UI carries.',
  },
] as const;

const handbookLinks = [
  {
    href: `${base}handbook/styling`,
    title: 'Styling',
    description:
      'Vase UI components can be styled with plain CSS, CSS Modules, or utility classes.',
  },
  {
    href: `${base}handbook/animation`,
    title: 'Animation',
    description:
      'Vase UI components can be animated with CSS transitions, CSS animations, or JavaScript.',
  },
  {
    href: `${base}handbook/composition`,
    title: 'Composition',
    description: 'Vase UI components can be replaced and composed with your own components.',
  },
] as const;

const triggerClassName =
  'flex h-8 items-center justify-center gap-1.5 bg-transparent px-2 text-sm font-normal text-neutral-950 no-underline select-none min-[501px]:px-3 hover:bg-neutral-100 aria-expanded:bg-neutral-100 focus-visible:outline-2 focus-visible:-outline-offset-1 focus-visible:outline-neutral-950 dark:focus-visible:outline-white dark:text-white dark:hover:bg-neutral-800 dark:aria-expanded:bg-neutral-800';
const contentTransitionClassName =
  'transition-[opacity,transform,translate] duration-[var(--duration)] ease-[var(--easing)]';
const contentTransition = {
  enterFromClass:
    'opacity-0 data-[activation-direction=left]:translate-x-[-50%] data-[activation-direction=right]:translate-x-[50%]',
  leaveToClass:
    'opacity-0 data-[activation-direction=left]:translate-x-[50%] data-[activation-direction=right]:translate-x-[-50%]',
};
const contentClassName = `h-full w-[calc(100vw_-_40px)] p-2 min-[500px]:w-max min-[500px]:min-w-[400px] ${contentTransitionClassName}`;
const linkCardClassName =
  'relative block h-full w-full border-0 bg-transparent p-2 text-left text-inherit no-underline hover:bg-neutral-100 active:bg-neutral-100 focus-visible:outline-2 focus-visible:-outline-offset-1 focus-visible:outline-neutral-950 dark:focus-visible:outline-white dark:hover:bg-neutral-800 dark:active:bg-neutral-800';
</script>

<template>
  <NavigationMenu.Root
    class="min-w-max text-neutral-950 dark:text-white"
    aria-label="Nested submenus"
  >
    <NavigationMenu.List class="relative flex gap-px">
      <NavigationMenu.Item>
        <NavigationMenu.Trigger :class="triggerClassName">
          Overview
          <NavigationMenu.Icon
            class="transition-transform duration-200 ease-[ease] data-popup-open:rotate-180"
          >
            <CaretDownIcon />
          </NavigationMenu.Icon>
        </NavigationMenu.Trigger>
        <NavigationMenu.Content :class="contentClassName" :transition="contentTransition">
          <ul class="m-0 grid list-none grid-cols-2 p-0 min-[640px]:grid-cols-[12rem_12rem]">
            <li v-for="item in overviewLinks" :key="item.href">
              <!-- For the link of a router, see the custom links of the docs. -->
              <NavigationMenu.Link :class="linkCardClassName" :href="item.href">
                <h3 class="m-0 mb-1 text-sm leading-4 font-normal">{{ item.title }}</h3>
                <p class="m-0 text-sm text-neutral-500 dark:text-neutral-400">
                  {{ item.description }}
                </p>
              </NavigationMenu.Link>
            </li>
            <li>
              <NavigationMenu.Root orientation="vertical">
                <NavigationMenu.List>
                  <NavigationMenu.Item>
                    <NavigationMenu.Trigger :class="linkCardClassName">
                      <span class="m-0 mb-1 text-sm leading-4 font-normal">Handbook</span>
                      <p class="m-0 text-sm text-neutral-500 dark:text-neutral-400">
                        How to use Vase UI effectively.
                      </p>
                      <NavigationMenu.Icon
                        class="absolute top-1/2 right-2.5 flex -translate-y-1/2 items-center justify-center transition-transform duration-200 ease-[ease] data-popup-open:rotate-180"
                      >
                        <CaretRightIcon />
                      </NavigationMenu.Icon>
                    </NavigationMenu.Trigger>
                    <NavigationMenu.Content
                      :class="contentClassName"
                      :transition="contentTransition"
                    >
                      <ul class="m-0 flex max-w-[400px] list-none flex-col justify-center p-0">
                        <li v-for="item in handbookLinks" :key="item.href">
                          <NavigationMenu.Link :class="linkCardClassName" :href="item.href">
                            <h3 class="m-0 mb-1 text-sm leading-4 font-normal">{{ item.title }}</h3>
                            <p class="m-0 text-sm text-neutral-500 dark:text-neutral-400">
                              {{ item.description }}
                            </p>
                          </NavigationMenu.Link>
                        </li>
                      </ul>
                    </NavigationMenu.Content>
                  </NavigationMenu.Item>
                </NavigationMenu.List>

                <NavigationMenu.Portal>
                  <NavigationMenu.Positioner
                    class="h-[var(--positioner-height)] w-[var(--positioner-width)] max-w-[var(--available-width)] transition-[top,left,right,bottom] duration-[var(--duration)] ease-[var(--easing)] before:absolute before:content-[''] data-instant:transition-none data-[side=bottom]:before:top-[-10px] data-[side=bottom]:before:right-0 data-[side=bottom]:before:left-0 data-[side=bottom]:before:h-2.5 data-[side=left]:before:top-0 data-[side=left]:before:right-[-10px] data-[side=left]:before:bottom-0 data-[side=left]:before:w-2.5 data-[side=right]:before:top-0 data-[side=right]:before:bottom-0 data-[side=right]:before:left-[-10px] data-[side=right]:before:w-2.5 data-[side=top]:before:right-0 data-[side=top]:before:bottom-[-10px] data-[side=top]:before:left-0 data-[side=top]:before:h-2.5"
                    :side-offset="8"
                    :align-offset="-8"
                    align="end"
                    side="right"
                    :style="{ '--duration': '0.35s', '--easing': 'cubic-bezier(0.22, 1, 0.36, 1)' }"
                  >
                    <Transition
                      enter-from-class="scale-90 opacity-0"
                      leave-to-class="scale-90 opacity-0 duration-150 ease-[ease]"
                      appear
                    >
                      <NavigationMenu.Popup
                        class="relative h-[var(--popup-height)] w-[var(--popup-width)] origin-[var(--transform-origin)] border border-neutral-950 bg-white text-neutral-950 shadow-[0.25rem_0.25rem_0] shadow-black/12 outline-none transition-[opacity,transform,width,height,scale] duration-[var(--duration)] ease-[var(--easing)] dark:border-white dark:bg-neutral-950 dark:text-white dark:shadow-none"
                      >
                        <NavigationMenu.Viewport class="relative h-full w-full overflow-hidden" />
                      </NavigationMenu.Popup>
                    </Transition>
                  </NavigationMenu.Positioner>
                </NavigationMenu.Portal>
              </NavigationMenu.Root>
            </li>
          </ul>
        </NavigationMenu.Content>
      </NavigationMenu.Item>
    </NavigationMenu.List>

    <NavigationMenu.Portal>
      <NavigationMenu.Positioner
        class="h-[var(--positioner-height)] w-[var(--positioner-width)] max-w-[var(--available-width)] transition-[top,left,right,bottom] duration-[var(--duration)] ease-[var(--easing)] before:absolute before:content-[''] data-instant:transition-none data-[side=bottom]:before:top-[-10px] data-[side=bottom]:before:right-0 data-[side=bottom]:before:left-0 data-[side=bottom]:before:h-2.5 data-[side=left]:before:top-0 data-[side=left]:before:right-[-10px] data-[side=left]:before:bottom-0 data-[side=left]:before:w-2.5 data-[side=right]:before:top-0 data-[side=right]:before:bottom-0 data-[side=right]:before:left-[-10px] data-[side=right]:before:w-2.5 data-[side=top]:before:right-0 data-[side=top]:before:bottom-[-10px] data-[side=top]:before:left-0 data-[side=top]:before:h-2.5"
        :side-offset="10"
        :collision-padding="{ top: 5, bottom: 5, left: 20, right: 20 }"
        :style="{ '--duration': '0.35s', '--easing': 'cubic-bezier(0.22, 1, 0.36, 1)' }"
      >
        <Transition
          enter-from-class="scale-90 opacity-0"
          leave-to-class="scale-90 opacity-0 duration-150 ease-[ease]"
          appear
        >
          <NavigationMenu.Popup
            class="relative h-[var(--popup-height)] w-[var(--popup-width)] origin-[var(--transform-origin)] border border-neutral-950 bg-white text-neutral-950 shadow-[0.25rem_0.25rem_0] shadow-black/12 outline-none transition-[opacity,transform,width,height,scale] duration-[var(--duration)] ease-[var(--easing)] dark:border-white dark:bg-neutral-950 dark:text-white dark:shadow-none"
          >
            <NavigationMenu.Arrow
              class="relative block h-1.5 w-3 overflow-clip transition-[left,right] duration-[var(--duration)] ease-[var(--easing)] before:absolute before:bottom-0 before:left-1/2 before:block before:h-[calc(6px*sqrt(2))] before:w-[calc(6px*sqrt(2))] before:-translate-x-1/2 before:translate-y-1/2 before:rotate-45 before:border before:border-neutral-950 before:bg-white before:content-[''] data-[side=bottom]:top-[-6px] data-[side=left]:right-[-9px] data-[side=left]:rotate-90 data-[side=right]:left-[-9px] data-[side=right]:-rotate-90 data-[side=top]:bottom-[-6px] data-[side=top]:rotate-180 dark:before:border-white dark:before:bg-neutral-950"
            />
            <NavigationMenu.Viewport class="relative h-full w-full overflow-hidden" />
          </NavigationMenu.Popup>
        </Transition>
      </NavigationMenu.Positioner>
    </NavigationMenu.Portal>
  </NavigationMenu.Root>
</template>

Nested inline submenus ​

A second level can stay in the panel of the first level. Then the nested root has no NavigationMenu.Portal. Give it a NavigationMenu.List, a NavigationMenu.Viewport and a defaultValue. A root with no portal opens and changes its item, and it does not close by itself: a NavigationMenu.Link with closeOnClick, close() and v-model close it.

vue
<script setup lang="ts">
import { h, onMounted, onUnmounted, ref } from 'vue';
import type { FunctionalComponent } from 'vue';
import { NavigationMenu } from '@vase-ui/vue/navigation-menu';
import { audienceMenus, guideLinks, guidesPanel } from '../data';
import styles from './index.module.css';

const transition = { enterFromClass: styles.EnterFrom, leaveToClass: styles.LeaveTo };

const base = import.meta.env.BASE_URL;
const isDesktop = ref(true);
let desktopQuery: MediaQueryList | undefined;
function updateDesktop({ matches }: { matches: boolean }) {
  isDesktop.value = matches;
}
onMounted(() => {
  desktopQuery = window.matchMedia('(min-width: 700px)');
  updateDesktop(desktopQuery);
  desktopQuery.addEventListener('change', updateDesktop);
});
onUnmounted(() => desktopQuery?.removeEventListener('change', updateDesktop));

const CaretDownIcon: FunctionalComponent = () =>
  h(
    'svg',
    {
      width: '16',
      height: '16',
      viewBox: '0 0 16 16',
      fill: 'currentColor',
      style: { display: 'block' },
    },
    [h('path', { d: 'M12 6H4l4 4.5z' })],
  );
</script>

<template>
  <NavigationMenu.Root :class="styles.Root" aria-label="Nested inline submenus">
    <NavigationMenu.List :class="styles.List">
      <NavigationMenu.Item>
        <NavigationMenu.Trigger :class="styles.Trigger">
          Product
          <NavigationMenu.Icon :class="styles.Icon">
            <CaretDownIcon />
          </NavigationMenu.Icon>
        </NavigationMenu.Trigger>
        <NavigationMenu.Content
          :class="[styles.Content, styles.ProductContent]"
          :transition="transition"
        >
          <NavigationMenu.Root
            :class="styles.SubmenuRoot"
            :orientation="isDesktop ? 'vertical' : 'horizontal'"
            default-value="developers"
          >
            <div :class="styles.SubmenuLayout">
              <NavigationMenu.List :class="styles.SubmenuList">
                <NavigationMenu.Item
                  v-for="menu in audienceMenus"
                  :key="menu.value"
                  :value="menu.value"
                >
                  <NavigationMenu.Trigger :class="styles.SubmenuTrigger">
                    <span :class="styles.SubmenuLabel">{{ menu.label }}</span>
                    <span :class="styles.SubmenuHint">{{ menu.hint }}</span>
                  </NavigationMenu.Trigger>
                  <NavigationMenu.Content :class="styles.SubmenuContent" :transition="transition">
                    <div>
                      <h4 :class="styles.SubmenuTitle">{{ menu.title }}</h4>
                      <p :class="styles.SubmenuDescription">{{ menu.description }}</p>
                    </div>
                    <ul :class="styles.LinkList">
                      <li v-for="link in menu.links" :key="link.href">
                        <!-- For the link of a router, see the custom links of the docs. -->
                        <NavigationMenu.Link :class="styles.LinkCard" :href="link.href">
                          <h5 :class="styles.LinkTitle">{{ link.title }}</h5>
                          <p :class="styles.LinkDescription">{{ link.description }}</p>
                        </NavigationMenu.Link>
                      </li>
                    </ul>
                  </NavigationMenu.Content>
                </NavigationMenu.Item>
              </NavigationMenu.List>

              <NavigationMenu.Viewport :class="styles.SubmenuViewport" />
            </div>
          </NavigationMenu.Root>
        </NavigationMenu.Content>
      </NavigationMenu.Item>

      <NavigationMenu.Item>
        <NavigationMenu.Trigger :class="styles.Trigger">
          Learn
          <NavigationMenu.Icon :class="styles.Icon">
            <CaretDownIcon />
          </NavigationMenu.Icon>
        </NavigationMenu.Trigger>
        <NavigationMenu.Content
          :class="[styles.Content, styles.GuidesContent]"
          :transition="transition"
        >
          <div :class="styles.GuidesPanel">
            <div>
              <h4 :class="styles.SubmenuTitle">{{ guidesPanel.title }}</h4>
              <p :class="styles.SubmenuDescription">{{ guidesPanel.description }}</p>
            </div>
            <ul :class="styles.LinkList">
              <li v-for="link in guideLinks" :key="link.href">
                <NavigationMenu.Link :class="styles.LinkCard" :href="link.href">
                  <h5 :class="styles.LinkTitle">{{ link.title }}</h5>
                  <p :class="styles.LinkDescription">{{ link.description }}</p>
                </NavigationMenu.Link>
              </li>
            </ul>
          </div>
        </NavigationMenu.Content>
      </NavigationMenu.Item>

      <NavigationMenu.Item>
        <NavigationMenu.Link :class="styles.Trigger" :href="`${base}parity`">
          Parity
        </NavigationMenu.Link>
      </NavigationMenu.Item>

      <NavigationMenu.Item>
        <NavigationMenu.Link :class="styles.Trigger" href="https://github.com/vase-ui/vase-ui">
          GitHub
        </NavigationMenu.Link>
      </NavigationMenu.Item>
    </NavigationMenu.List>

    <NavigationMenu.Portal>
      <NavigationMenu.Positioner
        :class="styles.Positioner"
        :side-offset="10"
        :collision-padding="{ top: 5, bottom: 5, left: 20, right: 20 }"
        :collision-avoidance="{ side: 'none' }"
      >
        <Transition :enter-from-class="styles.EnterFrom" :leave-to-class="styles.LeaveTo" appear>
          <NavigationMenu.Popup :class="styles.Popup">
            <NavigationMenu.Arrow :class="styles.Arrow" />
            <NavigationMenu.Viewport :class="styles.Viewport" />
          </NavigationMenu.Popup>
        </Transition>
      </NavigationMenu.Positioner>
    </NavigationMenu.Portal>
  </NavigationMenu.Root>
</template>
css
.Root {
  box-sizing: border-box;
  color: oklch(14.5% 0 0deg);
  min-width: max-content;

  @media (prefers-color-scheme: dark) {
    color: white;
  }
}

.List {
  display: flex;
  position: relative;
  gap: 1px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.Trigger {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  height: 2rem;
  padding: 0 0.75rem;
  margin: 0;
  outline: 0;
  border: 0;
  background-color: transparent;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.25rem;
  color: oklch(14.5% 0 0deg);
  -webkit-user-select: none;
  user-select: none;
  text-decoration: none;

  @media (max-width: 500px) {
    padding: 0 0.5rem;
  }

  @media (prefers-color-scheme: dark) {
    color: white;
  }

  @media (hover: hover) {
    &:hover {
      background-color: oklch(97% 0 0deg);

      @media (prefers-color-scheme: dark) {
        background-color: oklch(26.9% 0 0deg);
      }
    }
  }

  &[aria-expanded='true'] {
    background-color: oklch(97% 0 0deg);

    @media (prefers-color-scheme: dark) {
      background-color: oklch(26.9% 0 0deg);
    }
  }

  &:focus-visible {
    outline: 2px solid oklch(14.5% 0 0deg);
    outline-offset: -1px;

    @media (prefers-color-scheme: dark) {
      outline-color: white;
    }
  }
}

.Icon {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;

  &[data-popup-open] {
    transform: rotate(180deg);
  }
}

.Positioner {
  --easing: cubic-bezier(0.22, 1, 0.36, 1);
  --duration: 0.35s;
  box-sizing: border-box;
  transition-property: top, left, right, bottom;
  transition-duration: var(--duration);
  transition-timing-function: var(--easing);
  width: var(--positioner-width);
  height: var(--positioner-height);
  max-width: var(--available-width);

  &::before {
    content: '';
    position: absolute;
  }

  &[data-side='top']::before {
    left: 0;
    right: 0;
    bottom: -10px;
    height: 10px;
  }

  &[data-side='bottom']::before {
    left: 0;
    right: 0;
    top: -10px;
    height: 10px;
  }

  &[data-side='left']::before {
    top: 0;
    bottom: 0;
    right: -10px;
    width: 10px;
  }

  &[data-side='right']::before {
    top: 0;
    bottom: 0;
    left: -10px;
    width: 10px;
  }

  &[data-instant] {
    transition: none;
  }
}

.Popup {
  position: relative;
  overflow: visible;
  box-sizing: border-box;
  outline: 0;
  border: 1px solid oklch(14.5% 0 0deg);
  background-color: white;
  color: oklch(14.5% 0 0deg);
  box-shadow: 0.25rem 0.25rem 0 rgb(0 0 0 / 12%);
  transform-origin: var(--transform-origin);
  transition-property: opacity, transform, width, height;
  transition-duration: var(--duration);
  transition-timing-function: var(--easing);
  width: var(--popup-width);
  height: var(--popup-height);

  @media (prefers-color-scheme: dark) {
    border: 1px solid white;
    background-color: oklch(14.5% 0 0deg);
    color: white;
    box-shadow: none;
  }

  &.EnterFrom,
  &.LeaveTo {
    opacity: 0;
    transform: scale(0.9);
  }

  &.LeaveTo {
    transition-property: opacity, transform;
    transition-timing-function: ease;
    transition-duration: 0.15s;
  }
}

.Content {
  box-sizing: border-box;
  transition:
    opacity calc(var(--duration) * 0.5) ease,
    transform var(--duration) cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0.5rem;
  width: calc(100vw - 40px);
  height: 100%;

  &.EnterFrom,
  &.LeaveTo {
    opacity: 0;
  }

  &.EnterFrom {
    &[data-activation-direction='left'] {
      transform: translateX(-2rem);
    }
    &[data-activation-direction='right'] {
      transform: translateX(2rem);
    }
  }

  &.LeaveTo {
    transition-duration: calc(var(--duration) * 0.5);
    transition-timing-function: ease;

    &[data-activation-direction='left'] {
      transform: translateX(2rem);
    }
    &[data-activation-direction='right'] {
      transform: translateX(-2rem);
    }
  }
}

.ProductContent {
  padding: 0;

  @media (min-width: 700px) {
    width: min(675px, calc(100vw - 40px));
  }
}

.GuidesContent {
  padding: 0;

  @media (min-width: 700px) {
    width: min(500px, calc(100vw - 40px));
  }
}

.Viewport {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 100%;
}

.SubmenuRoot {
  color: oklch(14.5% 0 0deg);
  overflow: hidden;
  overflow: clip;

  @media (prefers-color-scheme: dark) {
    color: white;
  }
}

.SubmenuLayout {
  display: grid;
  grid-template-columns: 1fr;
  overflow: hidden;
  overflow: clip;
}

@media (min-width: 700px) {
  .SubmenuLayout {
    grid-template-columns: 13rem minmax(0, 1fr);
  }
}

.SubmenuList {
  box-sizing: border-box;
  list-style: none;
  margin: 0;
  padding: 0.5rem;
  display: flex;
  flex-direction: row;
  gap: 0.25rem;
  overflow-x: auto;
}

@media (min-width: 700px) {
  .SubmenuList {
    flex-direction: column;
    gap: 1px;
    overflow-x: visible;
    overflow-y: clip;
    border-right: 1px solid oklch(14.5% 0 0deg);
    height: var(--popup-height);
    transition: height var(--duration) var(--easing);

    @media (prefers-color-scheme: dark) {
      border-right: 1px solid white;
    }
  }
}

.SubmenuTrigger {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  width: 100%;
  min-width: 10rem;
  margin: 0;
  padding: 0.5rem;
  border: 0;
  background-color: transparent;
  color: inherit;
  font-family: inherit;
  text-align: left;

  @media (hover: hover) {
    &:hover {
      background-color: oklch(97% 0 0deg);

      @media (prefers-color-scheme: dark) {
        background-color: oklch(26.9% 0 0deg);
      }
    }
  }

  &[aria-expanded='true'] {
    background-color: oklch(97% 0 0deg);

    @media (prefers-color-scheme: dark) {
      background-color: oklch(26.9% 0 0deg);
    }
  }

  &:focus-visible {
    outline: 2px solid oklch(14.5% 0 0deg);
    outline-offset: -1px;

    @media (prefers-color-scheme: dark) {
      outline-color: white;
    }
  }
}

.SubmenuLabel {
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1rem;
  color: oklch(14.5% 0 0deg);

  @media (prefers-color-scheme: dark) {
    color: white;
  }
}

.SubmenuHint {
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: oklch(55.6% 0 0deg);

  @media (prefers-color-scheme: dark) {
    color: oklch(70.8% 0 0deg);
  }
}

.SubmenuViewport {
  position: relative;
  overflow: hidden;
  min-height: 16.5rem;
  border-top: 1px solid oklch(14.5% 0 0deg);

  @media (prefers-color-scheme: dark) {
    border-top: 1px solid white;
  }
}

@media (min-width: 700px) {
  .SubmenuViewport {
    border-top: 0;
  }
}

.SubmenuContent {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: 100%;
  padding: 1rem;
  transform: translateX(0);
  transition:
    opacity var(--duration) var(--easing),
    transform var(--duration) var(--easing),
    filter var(--duration) var(--easing);

  &.EnterFrom,
  &.LeaveTo {
    opacity: 0;
  }

  &.EnterFrom {
    &[data-activation-direction='left'] {
      transform: translateX(-50%);
    }

    &[data-activation-direction='right'] {
      transform: translateX(50%);
    }
  }

  &.LeaveTo {
    &[data-activation-direction='left'] {
      transform: translateX(50%);
    }

    &[data-activation-direction='right'] {
      transform: translateX(-50%);
    }
  }

  @media (min-width: 700px) {
    transform: translateY(0);
    filter: blur(0);
    transition-duration: calc(var(--duration) * 1.35);
    transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1);

    &.EnterFrom {
      &[data-activation-direction='up'] {
        transform: translateY(-72px);
      }

      &[data-activation-direction='down'] {
        transform: translateY(72px);
      }
    }

    &.LeaveTo {
      &[data-activation-direction='up'] {
        transform: translateY(72px);
      }

      &[data-activation-direction='down'] {
        transform: translateY(-72px);
      }
    }

    &.EnterFrom,
    &.LeaveTo {
      filter: blur(2px);
    }
  }
}

.SubmenuTitle {
  margin: 0;
  font-size: 1rem;
  line-height: 1.25rem;
  font-weight: 400;
}

.SubmenuDescription {
  margin: 0.25rem 0 0;
  color: oklch(55.6% 0 0deg);
  font-size: 0.875rem;
  line-height: 1.25rem;

  @media (prefers-color-scheme: dark) {
    color: oklch(70.8% 0 0deg);
  }
}

.LinkList {
  list-style: none;
  margin: 0 -0.5rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.LinkCard {
  box-sizing: border-box;
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0.5rem;
  text-decoration: none;
  color: inherit;
  text-align: left;
  border: 0;
  background-color: transparent;

  @media (hover: hover) {
    &:hover {
      background-color: oklch(97% 0 0deg);

      @media (prefers-color-scheme: dark) {
        background-color: oklch(26.9% 0 0deg);
      }
    }
  }

  &:focus-visible {
    outline: 2px solid oklch(14.5% 0 0deg);
    outline-offset: -1px;

    @media (prefers-color-scheme: dark) {
      outline-color: white;
    }
  }
}

.LinkTitle {
  margin: 0 0 4px;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1rem;
}

.LinkDescription {
  margin: 0;
  color: oklch(55.6% 0 0deg);
  font-size: 0.875rem;
  line-height: 1.25rem;

  @media (prefers-color-scheme: dark) {
    color: oklch(70.8% 0 0deg);
  }
}

.GuidesPanel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
}

.Arrow {
  display: block;
  position: relative;
  width: 12px;
  height: 6px;
  overflow: clip;
  transition:
    left var(--duration) var(--easing),
    right var(--duration) var(--easing);

  @media (max-width: 699px) {
    display: none;
  }

  &[data-side='top'] {
    bottom: -6px;
    rotate: 180deg;
  }

  &[data-side='bottom'] {
    top: -6px;
    rotate: 0deg;
  }

  &[data-side='left'] {
    right: -9px;
    rotate: 90deg;
  }

  &[data-side='right'] {
    left: -9px;
    rotate: -90deg;
  }

  &::before {
    content: '';
    display: block;
    position: absolute;
    bottom: 0;
    left: 50%;
    box-sizing: border-box;
    width: calc(6px * sqrt(2));
    height: calc(6px * sqrt(2));
    border: 1px solid oklch(14.5% 0 0deg);
    background-color: white;
    transform: translate(-50%, 50%) rotate(45deg);

    @media (prefers-color-scheme: dark) {
      border: 1px solid white;
      background-color: oklch(14.5% 0 0deg);
    }
  }
}
ts
const base = import.meta.env.BASE_URL;

export const audienceMenus = [
  {
    value: 'developers',
    label: 'Developers',
    hint: 'Go from idea to UI faster.',
    title: 'Build product UI without giving up control',
    description:
      'Start with accessible parts and shape them to your app instead of working around a preset design system.',
    links: [
      {
        href: `${base}quick-start`,
        title: 'Quick start',
        description: 'Install Vase UI and get your first interactive component on screen fast.',
      },
      {
        href: `${base}handbook/composition`,
        title: 'Composition',
        description: 'Wrap and combine parts to match your product structure without hacks.',
      },
    ],
  },
  {
    value: 'systems',
    label: 'Design Systems',
    hint: 'Keep patterns aligned across teams.',
    title: 'Turn shared standards into working components',
    description:
      'Connect tokens, states, and accessibility rules once, then give every product team the same solid starting point.',
    links: [
      {
        href: `${base}handbook/styling`,
        title: 'Styling',
        description: 'Map tokens and component states to your own CSS or utility setup.',
      },
      {
        href: `${base}components/tooltip`,
        title: 'Tooltip',
        description: 'Set one clear pattern for lightweight help, hints, and field guidance.',
      },
      {
        href: `${base}components/popover`,
        title: 'Popover',
        description: 'Handle richer anchored panels like menus, inspectors, and onboarding.',
      },
    ],
  },
  {
    value: 'managers',
    label: 'Engineering Leads',
    hint: 'Roll out shared UI without drag.',
    title: 'Give squads clear defaults and room to move',
    description:
      'Use the docs to align on quality bars, upgrades, and extension points while still leaving teams space to customize.',
    links: [
      {
        href: `${base}parity`,
        title: 'Parity',
        description:
          'Track which changes are mirrored and which are queued before upgrades surprise teams.',
      },
      {
        href: `${base}handbook/typescript`,
        title: 'TypeScript',
        description: 'See how Vase UI types custom wrappers and shared abstractions.',
      },
      {
        href: `${base}handbook/forms`,
        title: 'Forms',
        description: 'Standardize validation and field patterns teams reach for constantly.',
      },
    ],
  },
  {
    value: 'startups',
    label: 'Startups',
    hint: 'Ship polished basics while things change.',
    title: 'Get sturdy UI foundations in place early',
    description:
      'Cover the hard interaction details now so your team can spend more time on the product ideas that actually differentiate you.',
    links: [
      {
        href: `${base}quick-start`,
        title: 'Quick start',
        description: 'Get the package installed and your first component working in minutes.',
      },
      {
        href: `${base}components/menu`,
        title: 'Menu',
        description: 'Add action menus with keyboard support and focus handling already done.',
      },
      {
        href: `${base}components/dialog`,
        title: 'Dialog',
        description: 'Launch settings or upgrade flows without rebuilding focus management.',
      },
    ],
  },
] as const;

export const guidesPanel = {
  title: 'Where teams usually start',
  description:
    'These are the docs people reach for first when they are turning a prototype into shared UI.',
} as const;

export const guideLinks = [
  {
    href: `${base}quick-start`,
    title: 'Quick start',
    description: 'Install the package and put your first component on the page.',
  },
  {
    href: `${base}handbook/composition`,
    title: 'Composition',
    description: 'Learn when to wrap parts, share behavior, and expose flexible APIs.',
  },
  {
    href: `${base}handbook/styling`,
    title: 'Styling',
    description: 'Apply tokens and state styles without fighting the underlying markup.',
  },
] as const;
vue
<script setup lang="ts">
import { h, onMounted, onUnmounted, ref } from 'vue';
import type { FunctionalComponent } from 'vue';
import { NavigationMenu } from '@vase-ui/vue/navigation-menu';
import { audienceMenus, guideLinks, guidesPanel } from '../data';

const base = import.meta.env.BASE_URL;
const isDesktop = ref(true);
let desktopQuery: MediaQueryList | undefined;
function updateDesktop({ matches }: { matches: boolean }) {
  isDesktop.value = matches;
}
onMounted(() => {
  desktopQuery = window.matchMedia('(min-width: 700px)');
  updateDesktop(desktopQuery);
  desktopQuery.addEventListener('change', updateDesktop);
});
onUnmounted(() => desktopQuery?.removeEventListener('change', updateDesktop));

const CaretDownIcon: FunctionalComponent = () =>
  h(
    'svg',
    {
      width: '16',
      height: '16',
      viewBox: '0 0 16 16',
      fill: 'currentColor',
      style: { display: 'block' },
    },
    [h('path', { d: 'M12 6H4l4 4.5z' })],
  );

const triggerClassName =
  'flex h-8 items-center justify-center gap-1.5 bg-transparent px-2 text-sm font-normal text-neutral-950 no-underline select-none min-[501px]:px-3 hover:bg-neutral-100 aria-expanded:bg-neutral-100 focus-visible:outline-2 focus-visible:-outline-offset-1 focus-visible:outline-neutral-950 dark:focus-visible:outline-white dark:text-white dark:hover:bg-neutral-800 dark:aria-expanded:bg-neutral-800';
const sharedContentClassName =
  'h-full w-[calc(100vw_-_40px)] ' +
  'transition-[opacity,translate] duration-[calc(var(--duration)*0.5),var(--duration)] ease-[ease,cubic-bezier(0.4,0,0.2,1)]';
const sharedContentTransition = {
  enterFromClass:
    'data-[activation-direction=left]:opacity-0 data-[activation-direction=right]:opacity-0 data-[activation-direction=left]:translate-x-[-2rem] data-[activation-direction=right]:translate-x-[2rem]',
  leaveToClass:
    'opacity-0 duration-[calc(var(--duration)*0.5)] ease-[ease] data-[activation-direction=left]:translate-x-[2rem] data-[activation-direction=right]:translate-x-[-2rem]',
};
const productContentClassName = `${sharedContentClassName} p-0 min-[700px]:[width:min(675px,calc(100vw-40px))]`;
const guidesContentClassName = `${sharedContentClassName} p-0 min-[700px]:[width:min(500px,calc(100vw-40px))]`;
const submenuTriggerClassName =
  'm-0 flex w-full min-w-[10rem] flex-col items-start gap-1 border-0 bg-transparent p-2 text-left text-inherit hover:bg-neutral-100 aria-expanded:bg-neutral-100 focus-visible:outline-2 focus-visible:-outline-offset-1 focus-visible:outline-neutral-950 dark:focus-visible:outline-white dark:hover:bg-neutral-800 dark:aria-expanded:bg-neutral-800';
const submenuContentClassName =
  'flex h-full translate-x-0 flex-col gap-4 p-4 min-[700px]:blur-0 transition-[opacity,translate,filter] duration-[var(--duration)] ease-[var(--easing)] min-[700px]:duration-[calc(var(--duration)*1.35)] min-[700px]:ease-[cubic-bezier(0.16,1,0.3,1)]';
const submenuContentTransition = {
  enterFromClass:
    'data-[activation-direction=left]:opacity-0 data-[activation-direction=right]:opacity-0 data-[activation-direction=left]:translate-x-[-50%] data-[activation-direction=right]:translate-x-[50%] min-[700px]:data-[activation-direction=up]:opacity-0 min-[700px]:data-[activation-direction=down]:opacity-0 min-[700px]:data-[activation-direction=up]:translate-y-[-72px] min-[700px]:data-[activation-direction=down]:translate-y-[72px] min-[700px]:blur-[2px]',
  leaveToClass:
    'opacity-0 data-[activation-direction=left]:translate-x-[50%] data-[activation-direction=right]:translate-x-[-50%] min-[700px]:data-[activation-direction=up]:translate-y-[72px] min-[700px]:data-[activation-direction=down]:translate-y-[-72px] min-[700px]:blur-[2px]',
};
const linkCardClassName =
  'relative block h-full w-full border-0 bg-transparent p-2 text-left text-inherit no-underline hover:bg-neutral-100 focus-visible:outline-2 focus-visible:-outline-offset-1 focus-visible:outline-neutral-950 dark:focus-visible:outline-white dark:hover:bg-neutral-800';
</script>

<template>
  <NavigationMenu.Root
    class="min-w-max text-neutral-950 dark:text-white"
    aria-label="Nested inline submenus"
  >
    <NavigationMenu.List class="relative flex gap-px">
      <NavigationMenu.Item>
        <NavigationMenu.Trigger :class="triggerClassName">
          Product
          <NavigationMenu.Icon
            class="transition-transform duration-200 ease-[ease] data-popup-open:rotate-180"
          >
            <CaretDownIcon />
          </NavigationMenu.Icon>
        </NavigationMenu.Trigger>
        <NavigationMenu.Content
          :class="productContentClassName"
          :transition="sharedContentTransition"
        >
          <NavigationMenu.Root
            class="overflow-hidden overflow-clip text-neutral-950 dark:text-white"
            :orientation="isDesktop ? 'vertical' : 'horizontal'"
            default-value="developers"
          >
            <div
              class="grid grid-cols-1 overflow-hidden overflow-clip min-[700px]:grid-cols-[13rem_minmax(0,1fr)]"
            >
              <NavigationMenu.List
                class="m-0 flex list-none flex-row gap-1 overflow-x-auto p-2 min-[700px]:h-[var(--popup-height)] min-[700px]:flex-col min-[700px]:gap-px min-[700px]:overflow-x-visible min-[700px]:overflow-y-clip min-[700px]:border-r min-[700px]:border-r-neutral-950 min-[700px]:transition-[height] min-[700px]:duration-[var(--duration)] min-[700px]:ease-[var(--easing)] dark:min-[700px]:border-r-white"
              >
                <NavigationMenu.Item
                  v-for="menu in audienceMenus"
                  :key="menu.value"
                  :value="menu.value"
                >
                  <NavigationMenu.Trigger :class="submenuTriggerClassName">
                    <span class="text-sm leading-4 font-normal text-neutral-950 dark:text-white">{{
                      menu.label
                    }}</span>
                    <span class="text-sm text-neutral-500 dark:text-neutral-400">{{
                      menu.hint
                    }}</span>
                  </NavigationMenu.Trigger>
                  <NavigationMenu.Content
                    :class="submenuContentClassName"
                    :transition="submenuContentTransition"
                  >
                    <div>
                      <h4 class="m-0 text-base leading-5 font-normal">{{ menu.title }}</h4>
                      <p class="m-0 mt-1 text-sm text-neutral-500 dark:text-neutral-400">
                        {{ menu.description }}
                      </p>
                    </div>
                    <ul class="-mx-2 m-0 flex list-none flex-col gap-0 p-0">
                      <li v-for="link in menu.links" :key="link.href">
                        <!-- For the link of a router, see the custom links of the docs. -->
                        <NavigationMenu.Link :class="linkCardClassName" :href="link.href">
                          <h5 class="m-0 text-sm leading-4 font-normal">{{ link.title }}</h5>
                          <p class="m-0 text-sm text-neutral-500 dark:text-neutral-400">
                            {{ link.description }}
                          </p>
                        </NavigationMenu.Link>
                      </li>
                    </ul>
                  </NavigationMenu.Content>
                </NavigationMenu.Item>
              </NavigationMenu.List>

              <NavigationMenu.Viewport
                class="relative min-h-[16.5rem] overflow-hidden border-t border-neutral-950 min-[700px]:border-t-0 dark:border-white"
              />
            </div>
          </NavigationMenu.Root>
        </NavigationMenu.Content>
      </NavigationMenu.Item>

      <NavigationMenu.Item>
        <NavigationMenu.Trigger :class="triggerClassName">
          Learn
          <NavigationMenu.Icon
            class="transition-transform duration-200 ease-[ease] data-popup-open:rotate-180"
          >
            <CaretDownIcon />
          </NavigationMenu.Icon>
        </NavigationMenu.Trigger>
        <NavigationMenu.Content
          :class="guidesContentClassName"
          :transition="sharedContentTransition"
        >
          <div class="flex flex-col gap-4 p-4 text-neutral-950 dark:text-white">
            <div>
              <h4 class="m-0 text-base leading-5 font-normal">{{ guidesPanel.title }}</h4>
              <p class="m-0 mt-1 text-sm text-neutral-500 dark:text-neutral-400">
                {{ guidesPanel.description }}
              </p>
            </div>
            <ul class="-mx-2 m-0 flex list-none flex-col gap-0 p-0">
              <li v-for="link in guideLinks" :key="link.href">
                <NavigationMenu.Link :class="linkCardClassName" :href="link.href">
                  <h5 class="m-0 text-sm leading-4 font-normal">{{ link.title }}</h5>
                  <p class="m-0 text-sm text-neutral-500 dark:text-neutral-400">
                    {{ link.description }}
                  </p>
                </NavigationMenu.Link>
              </li>
            </ul>
          </div>
        </NavigationMenu.Content>
      </NavigationMenu.Item>

      <NavigationMenu.Item>
        <NavigationMenu.Link :class="triggerClassName" :href="`${base}parity`">
          Parity
        </NavigationMenu.Link>
      </NavigationMenu.Item>

      <NavigationMenu.Item>
        <NavigationMenu.Link :class="triggerClassName" href="https://github.com/vase-ui/vase-ui">
          GitHub
        </NavigationMenu.Link>
      </NavigationMenu.Item>
    </NavigationMenu.List>

    <NavigationMenu.Portal>
      <NavigationMenu.Positioner
        class="h-[var(--positioner-height)] w-[var(--positioner-width)] max-w-[var(--available-width)] transition-[top,left,right,bottom] duration-[var(--duration)] ease-[var(--easing)] before:absolute before:content-[''] data-instant:transition-none data-[side=bottom]:before:top-[-10px] data-[side=bottom]:before:right-0 data-[side=bottom]:before:left-0 data-[side=bottom]:before:h-2.5 data-[side=left]:before:top-0 data-[side=left]:before:right-[-10px] data-[side=left]:before:bottom-0 data-[side=left]:before:w-2.5 data-[side=right]:before:top-0 data-[side=right]:before:bottom-0 data-[side=right]:before:left-[-10px] data-[side=right]:before:w-2.5 data-[side=top]:before:right-0 data-[side=top]:before:bottom-[-10px] data-[side=top]:before:left-0 data-[side=top]:before:h-2.5"
        :side-offset="10"
        :collision-padding="{ top: 5, bottom: 5, left: 20, right: 20 }"
        :collision-avoidance="{ side: 'none' }"
        :style="{ '--duration': '0.35s', '--easing': 'cubic-bezier(0.22, 1, 0.36, 1)' }"
      >
        <Transition
          enter-from-class="scale-90 opacity-0"
          leave-to-class="scale-90 opacity-0 duration-150 ease-[ease] transition-[opacity,scale]"
          appear
        >
          <NavigationMenu.Popup
            class="relative h-[var(--popup-height)] w-[var(--popup-width)] origin-[var(--transform-origin)] border border-neutral-950 bg-white text-neutral-950 shadow-[0.25rem_0.25rem_0] shadow-black/12 outline-none transition-[opacity,transform,width,height,scale] duration-[var(--duration)] ease-[var(--easing)] dark:border-white dark:bg-neutral-950 dark:text-white dark:shadow-none"
          >
            <NavigationMenu.Arrow
              class="relative block h-1.5 w-3 overflow-clip transition-[left,right] duration-[var(--duration)] ease-[var(--easing)] before:absolute before:bottom-0 before:left-1/2 before:block before:h-[calc(6px*sqrt(2))] before:w-[calc(6px*sqrt(2))] before:-translate-x-1/2 before:translate-y-1/2 before:rotate-45 before:border before:border-neutral-950 before:bg-white before:content-[''] data-[side=bottom]:top-[-6px] data-[side=left]:right-[-9px] data-[side=left]:rotate-90 data-[side=right]:left-[-9px] data-[side=right]:-rotate-90 data-[side=top]:bottom-[-6px] data-[side=top]:rotate-180 dark:before:border-white dark:before:bg-neutral-950"
            />
            <NavigationMenu.Viewport class="relative h-full w-full overflow-hidden" />
          </NavigationMenu.Popup>
        </Transition>
      </NavigationMenu.Positioner>
    </NavigationMenu.Portal>
  </NavigationMenu.Root>
</template>
ts
const base = import.meta.env.BASE_URL;

export const audienceMenus = [
  {
    value: 'developers',
    label: 'Developers',
    hint: 'Go from idea to UI faster.',
    title: 'Build product UI without giving up control',
    description:
      'Start with accessible parts and shape them to your app instead of working around a preset design system.',
    links: [
      {
        href: `${base}quick-start`,
        title: 'Quick start',
        description: 'Install Vase UI and get your first interactive component on screen fast.',
      },
      {
        href: `${base}handbook/composition`,
        title: 'Composition',
        description: 'Wrap and combine parts to match your product structure without hacks.',
      },
    ],
  },
  {
    value: 'systems',
    label: 'Design Systems',
    hint: 'Keep patterns aligned across teams.',
    title: 'Turn shared standards into working components',
    description:
      'Connect tokens, states, and accessibility rules once, then give every product team the same solid starting point.',
    links: [
      {
        href: `${base}handbook/styling`,
        title: 'Styling',
        description: 'Map tokens and component states to your own CSS or utility setup.',
      },
      {
        href: `${base}components/tooltip`,
        title: 'Tooltip',
        description: 'Set one clear pattern for lightweight help, hints, and field guidance.',
      },
      {
        href: `${base}components/popover`,
        title: 'Popover',
        description: 'Handle richer anchored panels like menus, inspectors, and onboarding.',
      },
    ],
  },
  {
    value: 'managers',
    label: 'Engineering Leads',
    hint: 'Roll out shared UI without drag.',
    title: 'Give squads clear defaults and room to move',
    description:
      'Use the docs to align on quality bars, upgrades, and extension points while still leaving teams space to customize.',
    links: [
      {
        href: `${base}parity`,
        title: 'Parity',
        description:
          'Track which changes are mirrored and which are queued before upgrades surprise teams.',
      },
      {
        href: `${base}handbook/typescript`,
        title: 'TypeScript',
        description: 'See how Vase UI types custom wrappers and shared abstractions.',
      },
      {
        href: `${base}handbook/forms`,
        title: 'Forms',
        description: 'Standardize validation and field patterns teams reach for constantly.',
      },
    ],
  },
  {
    value: 'startups',
    label: 'Startups',
    hint: 'Ship polished basics while things change.',
    title: 'Get sturdy UI foundations in place early',
    description:
      'Cover the hard interaction details now so your team can spend more time on the product ideas that actually differentiate you.',
    links: [
      {
        href: `${base}quick-start`,
        title: 'Quick start',
        description: 'Get the package installed and your first component working in minutes.',
      },
      {
        href: `${base}components/menu`,
        title: 'Menu',
        description: 'Add action menus with keyboard support and focus handling already done.',
      },
      {
        href: `${base}components/dialog`,
        title: 'Dialog',
        description: 'Launch settings or upgrade flows without rebuilding focus management.',
      },
    ],
  },
] as const;

export const guidesPanel = {
  title: 'Where teams usually start',
  description:
    'These are the docs people reach for first when they are turning a prototype into shared UI.',
} as const;

export const guideLinks = [
  {
    href: `${base}quick-start`,
    title: 'Quick start',
    description: 'Install the package and put your first component on the page.',
  },
  {
    href: `${base}handbook/composition`,
    title: 'Composition',
    description: 'Learn when to wrap parts, share behavior, and expose flexible APIs.',
  },
  {
    href: `${base}handbook/styling`,
    title: 'Styling',
    description: 'Apply tokens and state styles without fighting the underlying markup.',
  },
] as const;

NavigationMenu.Link renders an <a> element. To navigate on the client, put a native <a> in the element slot of the link, in the slot of <RouterLink custom> or <NuxtLink custom>. The arrow keys of the menu then reach the link. Give it aria-current="page" from isExactActive.

A link for Vue Router:

vue
<script setup lang="ts">
import { NavigationMenu } from '@vase-ui/vue/navigation-menu';
import { RouterLink, type RouteLocationRaw } from 'vue-router';

// A native `<a>` in the `element` slot of the link, in the slot of `<RouterLink custom>`, so that
// the arrow keys of the menu reach it. The `<a>` of the current route has `aria-current="page"`.
// The attributes and `closeOnClick` go to the link, which merges them with its own.
defineOptions({ inheritAttrs: false });
defineProps<{ to: RouteLocationRaw }>();
</script>

<template>
  <RouterLink v-slot="{ href, navigate, isExactActive }" :to="to" custom>
    <NavigationMenu.Link v-bind="$attrs">
      <template #element="{ props, elementRef }">
        <a
          v-bind="props"
          :ref="elementRef"
          :href="href"
          :aria-current="isExactActive ? 'page' : undefined"
          @click="navigate"
        >
          <slot />
        </a>
      </template>
    </NavigationMenu.Link>
  </RouterLink>
</template>

A link for Nuxt:

vue
<script setup lang="ts">
import { NavigationMenu } from '@vase-ui/vue/navigation-menu';
import type { RouteLocationRaw } from 'vue-router';

// A native `<a>` in the `element` slot of the link, in the slot of `<NuxtLink custom>`, so that the
// arrow keys of the menu reach it. The `<a>` of the current route has `aria-current="page"`. The
// attributes and `closeOnClick` go to the link, which merges them with its own.
defineOptions({ inheritAttrs: false });
defineProps<{ to: RouteLocationRaw }>();
</script>

<template>
  <NuxtLink v-slot="{ href, navigate, isExactActive }" :to="to" custom>
    <NavigationMenu.Link v-bind="$attrs">
      <template #element="{ props, elementRef }">
        <a
          v-bind="props"
          :ref="elementRef"
          :href="href ?? undefined"
          :aria-current="isExactActive ? 'page' : undefined"
          @click="navigate"
        >
          <slot />
        </a>
      </template>
    </NavigationMenu.Link>
  </NuxtLink>
</template>

Large menus ​

Large menu content can be too big for the viewport. You can choose from two solutions.

  1. Make the content of the navigation menu smaller

Change the layout of the content so that it takes less space. If your content is flexible, give max-height to the popup. The navigation menu then becomes smaller, and the content does not overflow.

css
.Content,
.Popup {
  max-height: var(--available-height);
}
  1. Let the content of the navigation menu scroll
css
.Content,
.Popup {
  max-height: var(--available-height);
}

.Content {
  overflow-y: auto;
}

A native scrollbar is visible while the content changes. Use Scroll Area in place of a native scrollbar to hide it. The NavigationMenu.Arrow then also stays in the center.

Animate the content ​

NavigationMenu.Content renders its element in a <Transition> of its own, in a <Teleport> to the viewport. Use the transition prop of the content in place of a <Transition> around it. Its value is the props of that <Transition>, such as :transition="{ name: 'slide' }". At a change of the item, the old content leaves while the new one enters. Both have data-activation-direction, so the classes of the transition can move them to the side of the new trigger. At a close, the content stays in the popup and leaves with it.

While the popup changes its item, --popup-width and --popup-height give it its old size and then its new size. Give the popup a CSS transition of width and height to animate the change. Give the positioner width: var(--positioner-width) and height: var(--positioner-height). At the side top or left, the popup is then at the edge of the positioner that faces the trigger, so it grows away from the trigger.

Closing animations ​

A popup in a <Transition> stays in the DOM until its leave ends. An open during the leave waits, and the new item shows in a new popup after the leave. To keep the popup until an animation of JavaScript ends, use the JavaScript hooks of <Transition>. With :css="false", Vue removes the element when the leave hook calls done. See Animation.

With keepMounted on NavigationMenu.Portal, the popup stays in the DOM. Animate its leave with CSS on [hidden], as in Content that stays in the DOM. The popup keeps its content and its place until its animations end. An open during the leave shows the new item in the same popup, and the popup changes its size in steps.

API reference ​

NavigationMenu.Root ​

Groups the parts of the navigation menu. Renders a <nav> element, and a <div> in a navigation menu.

Props

PropTypeDefaultDescription
closeDelaynumber | undefined50The time in milliseconds before the close, after the pointer left the trigger and the popup.
defaultValueValue | null | undefinednullThe value of the open item at the mount of an uncontrolled root.
delaynumber | undefined50The time in milliseconds that a mouse rests on a trigger before the open.
modelValueValue | null | undefinedThe value of the open item, or null. v-model binds it.
orientationNavigationMenuOrientation | undefined'horizontal'The axis of the list: the arrow keys between the items and the key that opens an item.
askeyof HTMLElementTagNameMap | Component | GenericComponent | undefinedA tag or a component that the part renders in place of its own element, with the same attributes and content. The element slot wins over it.

Slots

SlotSlot propsDescription
default
state: NavigationMenuRootState
The content of the part.
element
props: Record<string, unknown>
elementRef: (target: unknown) => void
state: NavigationMenuRootState
Renders your element in place of the element of the part. Bind props with v-bind and elementRef with :ref.

Events

EventArgumentsDescription
valueChange[value: Value | null, details: NavigationMenuRootChangeEventDetails]The open item changes. details.cancel() keeps the menu as it was.
update:modelValue[value: Value | null]Comes after valueChange, unless a listener cancels the change. v-model uses it.

Exposed

MemberTypeDescription
elementHTMLElement | nullThe element of the part, or null while it is not mounted.
close() => voidCloses the open item.

NavigationMenu.List ​

The list of the items. Renders a <ul> element.

Props

PropTypeDefaultDescription
askeyof HTMLElementTagNameMap | Component | GenericComponent | undefinedA tag or a component that the part renders in place of its own element, with the same attributes and content. The element slot wins over it.

Slots

SlotSlot propsDescription
default
state: NavigationMenuListState
The content of the part.
element
props: Record<string, unknown>
elementRef: (target: unknown) => void
state: NavigationMenuListState
Renders your element in place of the element of the part. Bind props with v-bind and elementRef with :ref.

Exposed

MemberTypeDescription
elementHTMLElement | nullThe element of the part, or null while it is not mounted.

NavigationMenu.Item ​

An item of the list: a trigger with its content, or a link. Renders an <li> element.

Props

PropTypeDefaultDescription
valueValue | undefinedThe value of the item in v-model of the root. With no value, a generated id.
askeyof HTMLElementTagNameMap | Component | GenericComponent | undefinedA tag or a component that the part renders in place of its own element, with the same attributes and content. The element slot wins over it.

Slots

SlotSlot propsDescription
default
state: NavigationMenuItemState
The content of the part.
element
props: Record<string, unknown>
elementRef: (target: unknown) => void
state: NavigationMenuItemState
Renders your element in place of the element of the part. Bind props with v-bind and elementRef with :ref.

Exposed

MemberTypeDescription
elementHTMLElement | nullThe element of the part, or null while it is not mounted.

NavigationMenu.Trigger ​

A button that opens the content of its item. Renders a <button> element.

Props

PropTypeDefaultDescription
disabledboolean | undefinedfalseThe user cannot open the item. The trigger keeps the focus, with aria-disabled.
idstring | undefinedThe popup names the trigger of the open item by this id in aria-labelledby. With no value, a generated id.
askeyof HTMLElementTagNameMap | Component | GenericComponent | undefinedA tag or a component that the part renders in place of its own element, with the same attributes and content. The element slot wins over it.

Slots

SlotSlot propsDescription
default
state: NavigationMenuTriggerState
The content of the part.
element
props: Record<string, unknown>
elementRef: (target: unknown) => void
state: NavigationMenuTriggerState
Renders your element in place of the element of the part. Bind props with v-bind and elementRef with :ref.

Exposed

MemberTypeDescription
elementHTMLElement | nullThe element of the part, or null while it is not mounted.

Selectors

SelectorDescription
[aria-expanded="true"]The item of the trigger is open.
[aria-disabled="true"]The trigger is disabled. It keeps the focus.
:disabledThe trigger is a native button in a disabled fieldset.

NavigationMenu.Icon ​

An icon of the open state of the item. Renders a <span> element.

Props

PropTypeDefaultDescription
askeyof HTMLElementTagNameMap | Component | GenericComponent | undefinedA tag or a component that the part renders in place of its own element, with the same attributes and content. The element slot wins over it.

Slots

SlotSlot propsDescription
default
state: NavigationMenuIconState
The content of the part.
element
props: Record<string, unknown>
elementRef: (target: unknown) => void
state: NavigationMenuIconState
Renders your element in place of the element of the part. Bind props with v-bind and elementRef with :ref.

Exposed

MemberTypeDescription
elementHTMLElement | nullThe element of the part, or null while it is not mounted.

Selectors

SelectorDescription
[data-popup-open]The item of the icon is open.

NavigationMenu.Content ​

The content of the item. It shows in the viewport. Its root is a <Teleport>, so a scoped style of the parent does not reach its element: use a CSS module class, :deep() or the element slot. Renders a <div> element.

Props

PropTypeDefaultDescription
idstring | undefinedThe trigger names the content by this id in aria-controls. With no value, a generated id.
keepMountedboolean | undefinedfalseThe content stays in the DOM while its item is closed, with hidden. The server HTML then has it in its item. After the hydration, Vue mounts it again in its <Teleport>, so a component in it mounts two times.
transitionTransitionProps | undefinedThe props of the <Transition> around the element, such as name, for the change of the item.
askeyof HTMLElementTagNameMap | Component | GenericComponent | undefinedA tag or a component that the part renders in place of its own element, with the same attributes and content. The element slot wins over it.

Slots

SlotSlot propsDescription
default
state: NavigationMenuContentState
The content of the part.
element
props: Record<string, unknown>
elementRef: (target: unknown) => void
state: NavigationMenuContentState
Renders your element in place of the element of the part. Bind props with v-bind and elementRef with :ref.

Exposed

MemberTypeDescription
elementHTMLElement | nullThe element of the part, or null while it is not mounted.

Selectors

SelectorDescription
[data-activation-direction]The side of the new trigger from the old one at the last change of the item: left, right, up or down.
[hidden]The item is closed, and keepMounted keeps the content in the DOM.

A link in the list or in a content. Renders an <a> element.

Props

PropTypeDefaultDescription
closeOnClickboolean | undefinedfalseA press of the link closes the menu and each menu above it.
askeyof HTMLElementTagNameMap | Component | GenericComponent | undefinedA tag or a component that the part renders in place of its own element, with the same attributes and content. The element slot wins over it.

Slots

SlotSlot propsDescription
default
state: NavigationMenuLinkState
The content of the part.
element
props: Record<string, unknown>
elementRef: (target: unknown) => void
state: NavigationMenuLinkState
Renders your element in place of the element of the part. Bind props with v-bind and elementRef with :ref.

Exposed

MemberTypeDescription
elementHTMLElement | nullThe element of the part, or null while it is not mounted.

Selectors

SelectorDescription
[aria-current="page"]The link goes to the current page. Give the link this attribute.

NavigationMenu.Backdrop ​

An overlay under the popup. Renders a <div> element.

Props

PropTypeDefaultDescription
askeyof HTMLElementTagNameMap | Component | GenericComponent | undefinedA tag or a component that the part renders in place of its own element, with the same attributes and content. The element slot wins over it.

Slots

SlotSlot propsDescription
default
state: NavigationMenuBackdropState
The content of the part.
element
props: Record<string, unknown>
elementRef: (target: unknown) => void
state: NavigationMenuBackdropState
Renders your element in place of the element of the part. Bind props with v-bind and elementRef with :ref.

Exposed

MemberTypeDescription
elementHTMLElement | nullThe element of the part, or null while it is not mounted.

Selectors

SelectorDescription
[hidden]The menu is closed, and keepMounted of the portal keeps the backdrop in the DOM.

NavigationMenu.Portal ​

Moves its content to another place of the DOM, <body> by default. Renders no element.

Props

PropTypeDefaultDescription
deferboolean | undefinedfalseMoves the content after the other content of the same update mounted.
disabledboolean | undefinedfalseRenders the content in place, also on the server.
keepMountedboolean | undefinedfalseThe closed popup stays in the DOM, with hidden and inert.
toPortalTarget | undefinedThe target of the content. With no value, the target of the nearest portal above, else body. While it is null, the portal renders nothing.

Slots

SlotSlot propsDescription
defaultThe content of the part.

NavigationMenu.Positioner ​

Places the popup at the active trigger. Renders a <div> element.

Props

PropTypeDefaultDescription
alignAlign | undefined'center'The alignment of the popup on the side.
alignOffsetnumber | OffsetFunction | undefined0The offset on the align axis in pixels, or a function that gives it.
anchorAnchor | (() => Anchor)The element to place the popup against: an element, a virtual element, a template ref of a part, or a function that gives one. With no value, the active trigger.
arrowPaddingnumber | undefined5The smallest space between the arrow and an inner edge of its nearest positioned ancestor, in pixels.
collisionAvoidanceCollisionAvoidance | undefinedHow the popup avoids the edge of the boundary.
collisionBoundaryBoundary | undefined'clipping-ancestors'The area that holds the popup: an element, elements, or a rectangle.
collisionPaddingPadding | undefined5The space between the popup and the edge of the boundary, in pixels.
disableAnchorTrackingboolean | undefinedfalseThe popup does not follow a move of its anchor.
positionMethod"absolute" | "fixed" | undefined'absolute'The CSS position of the positioner.
sideSide | undefined'bottom'The side of the anchor for the popup. It can change to avoid a collision. inline-start and inline-end follow the CSS direction of the positioner: give the positioner dir when the target of its portal has another direction.
sideOffsetnumber | OffsetFunction | undefined0The distance from the anchor in pixels, or a function that gives it.
stickyboolean | undefinedfalseThe popup stays in the view after its anchor scrolls out of it.
askeyof HTMLElementTagNameMap | Component | GenericComponent | undefinedA tag or a component that the part renders in place of its own element, with the same attributes and content. The element slot wins over it.

Slots

SlotSlot propsDescription
default
state: NavigationMenuPositionerState
The content of the part.
element
props: Record<string, unknown>
elementRef: (target: unknown) => void
state: NavigationMenuPositionerState
Renders your element in place of the element of the part. Bind props with v-bind and elementRef with :ref.

Exposed

MemberTypeDescription
elementHTMLElement | nullThe element of the part, or null while it is not mounted.

Selectors

SelectorDescription
[data-side]The side of the trigger that the popup is on: top, bottom, left, right, inline-start or inline-end. A logical side shows only when the side prop is logical.
[data-align]The alignment of the popup on its side: start, center or end.
[data-anchor-hidden]The trigger is out of view.
[data-instant]An animation should not run: the popup takes its first place at an open, or the window changes its size.
[hidden]The menu is closed, and keepMounted of the portal keeps the positioner in the DOM.

CSS variables

VariableDescription
--anchor-widthThe width of the trigger, in pixels.
--anchor-heightThe height of the trigger, in pixels.
--available-widthThe width from the trigger to the edge of the collision boundary, in pixels.
--available-heightThe height from the trigger to the edge of the collision boundary, in pixels.
--transform-originThe point that the popup grows from, for the transform-origin of the popup. It is at the arrow, on the edge of the anchor. With no arrow, it is at the aligned edge of the popup or at the center of the anchor.
--positioner-widthThe width of the popup, and at a change of the item the width of the new content, in pixels.
--positioner-heightThe height of the popup, and at a change of the item the height of the new content, in pixels.

NavigationMenu.Popup ​

The container of the viewport. Renders a <nav> element.

Props

PropTypeDefaultDescription
askeyof HTMLElementTagNameMap | Component | GenericComponent | undefinedA tag or a component that the part renders in place of its own element, with the same attributes and content. The element slot wins over it.

Slots

SlotSlot propsDescription
default
state: NavigationMenuPopupState
The content of the part.
element
props: Record<string, unknown>
elementRef: (target: unknown) => void
state: NavigationMenuPopupState
Renders your element in place of the element of the part. Bind props with v-bind and elementRef with :ref.

Exposed

MemberTypeDescription
elementHTMLElement | nullThe element of the part, or null while it is not mounted.

Selectors

SelectorDescription
[data-side]The side of the trigger that the popup is on, as on the positioner.
[data-align]The alignment of the popup on its side: start, center or end.
[data-anchor-hidden]The trigger is out of view.
[hidden]The menu is closed, and keepMounted of the portal keeps the popup in the DOM.

CSS variables

VariableDescription
--popup-widthThe width of the popup, in pixels: the old width, then the new width, while the popup changes its item.
--popup-heightThe height of the popup, in pixels: the old height, then the new height, while the popup changes its item.

NavigationMenu.Viewport ​

The place where the content of the open item shows. Renders a <div> element.

Props

PropTypeDefaultDescription
askeyof HTMLElementTagNameMap | Component | GenericComponent | undefinedA tag or a component that the part renders in place of its own element, with the same attributes and content. The element slot wins over it.

Slots

SlotSlot propsDescription
default
state: NavigationMenuViewportState
The content of the part.
element
props: Record<string, unknown>
elementRef: (target: unknown) => void
state: NavigationMenuViewportState
Renders your element in place of the element of the part. Bind props with v-bind and elementRef with :ref.

Exposed

MemberTypeDescription
elementHTMLElement | nullThe element of the part, or null while it is not mounted.

NavigationMenu.Arrow ​

An element that points to the center of the active trigger. Renders a <div> element. Its place is in the padding box of its nearest positioned ancestor: the popup when the popup has a position, else the positioner.

Props

PropTypeDefaultDescription
askeyof HTMLElementTagNameMap | Component | GenericComponent | undefinedA tag or a component that the part renders in place of its own element, with the same attributes and content. The element slot wins over it.

Slots

SlotSlot propsDescription
default
state: NavigationMenuArrowState
The content of the part.
element
props: Record<string, unknown>
elementRef: (target: unknown) => void
state: NavigationMenuArrowState
Renders your element in place of the element of the part. Bind props with v-bind and elementRef with :ref.

Exposed

MemberTypeDescription
elementHTMLElement | nullThe element of the part, or null while it is not mounted.

Selectors

SelectorDescription
[data-side]The side of the trigger that the popup is on, as on the positioner.
[data-align]The alignment of the popup on its side: start, center or end.
[data-uncentered]The arrow cannot point to the center of the trigger.

Differences from Base UI ​

Vase UI ports Navigation Menu from Base UI 1.9.0.

API ​

Base UIVase UI
NavigationMenu.Root prop onOpenChangeComplete@after-enter and @after-leave of a <Transition> around the popup run after its animations.
NavigationMenu.Root prop actionsRefA template ref of the root has close(). With :css="false", the JavaScript hooks of the <Transition> of the popup keep it in the DOM until done, so the root has no unmount action.
NavigationMenu.Trigger prop nativeButtonThe trigger reads the element that it renders, so it has no nativeButton.
NavigationMenu.ContentThe classes of its transition animate the content, so the state has no transitionStatus, and the content has no data-starting-style and data-ending-style. The content of a closed item is out of the DOM, or it has hidden with keepMounted, so CSS selects [hidden] and the content has no data-open and data-closed.
NavigationMenu.LinkThe developer gives the link aria-current="page", and CSS selects [aria-current="page"]. With a router, isExactActive of <RouterLink custom> gives it. The link thus has no active prop and no state.
NavigationMenu.BackdropThe classes of <Transition> animate the backdrop, so the state has no transitionStatus, and the backdrop has no data-starting-style and data-ending-style. A closed backdrop is out of the DOM, or it has hidden with keepMounted of the portal, so CSS selects [hidden] and the backdrop has no data-open and data-closed.
NavigationMenu.Portal prop renderThe portal is a <Teleport> and renders no element of its own, so it has no render, as or exposed element. The developer writes an element in the portal.
NavigationMenu.PopupThe classes of <Transition> animate the popup, so the state has no transitionStatus, and the popup has no data-starting-style and data-ending-style. A closed popup is out of the DOM, or it has hidden with keepMounted of the portal, so CSS selects [hidden] and the popup has no data-open and data-closed.

Added in Vase UI ​

PartMemberWhy
NavigationMenu.Portaldisabled propA disabled portal renders at its source, also on the server (VUE-128).
NavigationMenu.Portaldefer propThe portal is a <Teleport>, and it takes the props of <Teleport>: defer waits for the other content of the update.
NavigationMenu.Contenttransition propThe part renders its element in a <Transition> of its own, with these props and its own hooks: at a change of the item, the old content leaves out of the flow with data-activation-direction, and at a close the content stays in the popup and leaves with it.

Behavior ​

Vase UIEvidence
A part that renders an element has one root node: its element, or one comment while it has no element, as Collapsible.Panel and Tabs.Indicator do. Toast.Viewport keeps its sentinels in its element, and the script of Tabs.Indicator with renderBeforeHydration is the last child of its element. A rule of <style scoped>, v-show, a custom directive and a <Transition> of the developer thus apply to the element of the part. Only NavigationMenu.Content has another root, a <Teleport>, so a scoped rule, v-show and a directive of the developer do not reach its default element. The element slot gives them, and the prop transition gives the <Transition> of the part.
An open NavigationMenu.Trigger follows each change of the id of its NavigationMenu.Content in its aria-controls. No element has aria-owns. An element with an empty id gives no attribute. Base UI reads the id of the element when the trigger renders, so after a change of the id the trigger names the old id until it renders again. No element has that id.
A Navigation Menu root with an inline viewport has no popup, positioner or backdrop element. When it closes with the focus in its viewport, it returns the focus to its trigger, as a root with a popup element does. A nested root with an inline viewport is such a root, and its parent menu stays open. Base UI returns the focus only when a popup element exists. Thus a Base UI root with an inline viewport does not return the focus to its trigger.
A Navigation Menu popup takes its accessible name from its trigger: aria-labelledby has the id of the active trigger, and each trigger has an id. Each open popup is thus a navigation landmark with a name of its own, also in a nested menu. The popup keeps the name until it unmounts. When the consumer gives the popup an aria-label or an aria-labelledby, the popup takes the name of the consumer. Base UI gives the popup no name. Thus two open popups, or one popup beside a root with no name, are two navigation landmarks with no name.
The Navigation Menu popup names the trigger of the open item in aria-labelledby with the id of the trigger part, so a new id prop of the trigger also changes the aria-labelledby of the open popup, and the popup keeps its name. Base UI reads the id of the trigger element when a part of the menu renders. A new id of the render element that changes no state of the menu can thus leave an aria-labelledby that names no element.
An open Popover can have no popup part, and an open Navigation Menu can have no viewport. A consumer can remove the part with v-if, or the part can be an async component that has not loaded. The Tab key then skips the popup, as it skips a popup with no tabbable element. Shift+Tab moves the focus from the element after Popover.Trigger to the trigger, and it asks for no close. Tab moves the focus from an active NavigationMenu.Trigger to the next tabbable element, and Shift+Tab moves it from that element to the trigger. Tab from NavigationMenu.Trigger closes the item with the reason focus-out in the cases where Tab from the end of a viewport closes it. In Base UI, Shift+Tab from the element after the trigger of such a Popover focuses that element again. Tab from an active NavigationMenu.Trigger with no viewport focuses that trigger again, and Shift+Tab from the next trigger focuses the next trigger again.
A touch outside an open popup closes it only at a tap. A tap ends with pointerup in less than 1 s and moves 8 px or less. Chromium on Android sends click for a move of 8 px and not for 8.1 px, the smallest limit of the measured browsers. A touch that scrolls the page ends with pointercancel and closes nothing, as a native popover stays open in Chromium and WebKit. A drag of more than 8 px on an element that does not scroll also closes nothing. A tap on a backdrop, or on the element that a modal popup puts over the page, closes the popup and gives the page under it no click. In Base UI, a touch that scrolls the page closes a Popover, a Menu or a Select.
An arrow points at the center of its anchor. Its place is in the padding box of its nearest positioned ancestor, so the borders of a popup with a position do not move it. arrowPadding keeps the same space from each inner edge of that box. In the Popover demo of Base UI, the popup has position: relative and a 1 px border, and the arrow is 1.5 px off the center of its trigger.
--transform-origin is in the pixels of the popup, from its border box: the arrow or the aligned edge or the center of the anchor, on the edge of the anchor. A margin of the popup, a padding of the positioner, a margin that collapses through the popup and a zoom of the popup do not move it. A Select popup over the trigger grows from the middle of the value, also after it grows while the user scrolls the list. In the Popover demo of Base UI, a 16 px margin on the popup moves the origin 16 px off the edge of the trigger.
An arrow in a popup with a CSS zoom points at the center of its anchor. Its place and arrowPadding are in the pixels of its nearest positioned ancestor. A Select popup over the trigger with a zoom puts the text of the selected item over the text of the value. In the Popover demo of Base UI, a zoom: 2 on the popup moves the arrow 225 px off the center of the trigger.
A button part knows the element of a component in as or of the element slot only at the mount, and it needs no prop that says what the element is. Until the mount, the element has the attributes that suit a <button> and each other element: type="button", role="button", a tab stop, and the disabled state of both. So in the server HTML, Tab reaches a <div> before a lazy hydration, and a <button> does not submit its form. At the mount, the part keeps the attributes of its element. Base UI needs nativeButton set to false for an element that is not a <button>.

The handbook gives the differences that all components share: Styling, Animation, Composition, Customization, Forms and TypeScript.