N
Nuxt4mo ago
Alex

uheader :open not working

I am using UHeader in nuxtUI pro. I want to toggle the open state programatically: <UHeader title="title" mode="slideover" :open="localeMenuOpen"> I have a constant defined: const localeMenuOpen = ref(false) which I set to false when I select one of the items: const setLocale = (code: string) => { console.log('changing locale to: ' + code + '') locale.value = code localeMenuOpen.value = false } It does not close the menu when I select one item. What am I missing?
3 Replies
kapa.ai
kapa.ai4mo ago
Hi @Alex. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- I'm sorry, but the knowledge sources do not mention an open or :open prop for the UHeader component in Nuxt UI Pro. According to the official documentation, the UHeader component does not support controlling its open state programmatically via an open prop or v-model:open. The available props and slots are for customizing the title, menu, mode, and toggle button, but there is no documented way to control the menu's open state directly through a prop like open or v-model:open UHeader Usage UHeader Mode. This is different from components like USlideover, UModal, or UDrawer, which explicitly support open state control via v-model:open or an open prop Slideover Control Open State Drawer Control Open State Modal Control Open State. If you need to programmatically control the open state of a menu, you may need to use a different component (such as USlideover, UModal, or UDrawer) or implement a custom solution. If you believe this should work, please double-check the documentation for any recent updates or consider opening an issue on the Nuxt UI Pro GitHub repository. Summary:
The UHeader component does not support an open or v-model:open prop for programmatic control of its menu state, based on the current documentation. This is likely why your approach is not working. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai4mo ago
<@822057189556486186> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Alex
AlexOP4mo ago
The documentation mentions an "open" property: https://ui.nuxt.com/components/header
Nuxt UI
Vue Header Component - Nuxt UI Pro
A responsive header component.

Did you find this page helpful?