Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open submenu status in vertical NavigationMenu #2608

Closed
kofeinstyle opened this issue Nov 12, 2024 · 1 comment
Closed

Open submenu status in vertical NavigationMenu #2608

kofeinstyle opened this issue Nov 12, 2024 · 1 comment
Labels
question Further information is requested v3 #1289

Comments

@kofeinstyle
Copy link

kofeinstyle commented Nov 12, 2024

For what version of Nuxt UI are you asking this question?

v3-alpha

Description

For what version of Nuxt UI are you asking this question?

v3.0.0-alpha.8

Component

NavigationMenu

Description

I’m trying to use navigation-menu from Nuxt UI v3.0.0-alpha. I’m using the vertical menu for page navigation in the sidebar.

When navigating to the /products page, the menu item is highlighted as selected, but after reloading the page, the submenu appears closed. However, if I open it, you can see that it is selected.

Is this an error in alpha.8 or how can I achieve an open submenu state after a page reload if current route matched? Additionally, is it possible to set all submenus to expanded by default?

<script lang="ts" setup>
const items = ref([
  [
    {
      label: 'Home',
      icon: 'i-lucide-home',
      to: '/',
    },
    {
      label: 'Products',
      icon: 'i-lucide-package-search',
      children: [
        {
          label: 'Products',
          icon: 'i-lucide-package-search',
          to: '/products',
        },
      ],
    },
  ],
])
</script>
<template>
  <div>
    <UNavigationMenu
      orientation="vertical"
      :items="items"
      class="data-[orientation=vertical]:w-full data-[orientation=vertical]:border-l border-[var(--ui-border)]"
    />
  </div>
</template>
@kofeinstyle kofeinstyle added the question Further information is requested label Nov 12, 2024
@benjamincanac
Copy link
Member

Just added the ability to pass open & defaultOpen on items that will be passed to the Collapsible component used underneath.

@benjamincanac benjamincanac added the v3 #1289 label Nov 19, 2024 — with Volta.net
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested v3 #1289
Projects
None yet
Development

No branches or pull requests

2 participants