Skip to content

Commit 44f536f

Browse files
committed
fix(NavigationMenu): only display tooltip when collapsed
1 parent d0be599 commit 44f536f

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

playground/app/pages/components/navigation-menu.vue

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ const items = [
2222
label: 'Documentation',
2323
icon: 'i-lucide-book-open',
2424
badge: 10,
25+
tooltip: {
26+
text: 'Documentation'
27+
},
2528
children: [{
2629
label: 'Introduction',
2730
description: 'Fully styled and customizable components for Nuxt.',
@@ -42,9 +45,12 @@ const items = [
4245
}, {
4346
label: 'Components',
4447
icon: 'i-lucide-box',
45-
to: '/components',
48+
to: '/components/navigation-menu',
4649
active: true,
4750
defaultOpen: true,
51+
tooltip: {
52+
text: 'Components'
53+
},
4854
children: [{
4955
label: 'Link',
5056
icon: 'i-lucide-link',
@@ -81,11 +87,17 @@ const items = [
8187
label: 'GitHub',
8288
icon: 'i-simple-icons-github',
8389
to: 'https://github.com/nuxt/ui',
84-
target: '_blank'
90+
target: '_blank',
91+
tooltip: {
92+
text: 'GitHub'
93+
}
8594
}, {
8695
label: 'Help',
8796
icon: 'i-lucide-circle-help',
88-
disabled: true
97+
disabled: true,
98+
tooltip: {
99+
text: 'Help'
100+
}
89101
}]
90102
]
91103
</script>

src/runtime/components/NavigationMenu.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,8 @@ function getAccordionDefaultValue(list: NavigationMenuItem[]) {
288288
:disabled="item.disabled"
289289
@select="item.onSelect"
290290
>
291-
<UTooltip v-if="!!item.tooltip" :content="{ side: 'right' }" v-bind="item.tooltip">
292-
<ULinkBase v-bind="slotProps" :class="ui.link({ class: [props.ui?.link, item.ui?.link, item.class], active, disabled: !!item.disabled, level: orientation === 'horizontal' || level > 0 })">
291+
<UTooltip v-if="!!item.tooltip && orientation === 'vertical' && collapsed" :content="{ side: 'right' }" v-bind="item.tooltip">
292+
<ULinkBase v-bind="slotProps" :class="ui.link({ class: [props.ui?.link, item.ui?.link, item.class], active, disabled: !!item.disabled, level: level > 0 })">
293293
<ReuseLinkTemplate :item="item" :active="active" :index="index" />
294294
</ULinkBase>
295295
</UTooltip>

0 commit comments

Comments
 (0)