Comments (5)
Wouldn't it be simpler to use a Popover
for this? https://ui.nuxt.com/components/popover
from ui.
I saw your example and found something wrong with your configuration,
In UDropdown
components, currently the open-delay
or close-delay
configuration will only take effect when the mode is hover
.
If you want to use open-delay
or close-delay
, you can try changing your component configuration to the following content.
<UDropdown
:items="items"
:mode="'hover'"
:open-delay="1000"
:close-delay="1000"
:ui="{ item: { disabled: 'cursor-text select-text' } }"
>
<UAvatar src="https://avatars.githubusercontent.com/u/739984?v=4" />
<template #account="{ item }">
<div class="text-left">
<p>Signed in as</p>
<p class="truncate font-medium text-gray-900 dark:text-white">
{{ item.label }}
</p>
</div>
</template>
<template #item="{ item }">
<span class="truncate">{{ item.label }}</span>
<UIcon :name="item.icon" class="flex-shrink-0 h-4 w-4 text-gray-400 dark:text-gray-500 ms-auto" />
</template>
</UDropdown>
from ui.
Ah right, I missed that it is only for hover. Is this documented?
I am trying to prevent the dropdown from closing when it is clicked as I am building a drill down filter using the dropdown component.
Essentially, I am replacing the items with a new set of items when the user clicks to achieve this drill down effect.
It works really well apart from a small issue because it closes on click.
My workaround: on click I reopen it after 1ms but the side effect is that it causes a flash.
I was hoping I could use delay to get around this.
Is there a way to prevent the dropdown closing on click?
from ui.
It is not reflected in the documentation that open-delay or close-delay must be when mode is hover. Maybe I can try adding it to the documentation.
As for the need to delay when clicking, it seems that it is not supported at present.
from ui.
@benjamincanac Thanks, I was just thinking the same. I am going to rework it to use the verticalNavigation inside a popover. That way I can still control which set of menu items are showing like I can with the drop down but without the side effects.
from ui.
Related Issues (20)
- Add `no-trailing-spaces` to eslint config
- USelectMenu: adding `multiple` prop throws error HOT 2
- Eager validation not working as expected HOT 4
- [Question] How to use custom font HOT 1
- Nuxt Dev server broken after 2.16.0 update HOT 12
- Can we have resize component? HOT 1
- How to disable selection input in <UTable>? HOT 4
- UButton - activeClass does not work when switching from another layout
- nuxt How to develop browser extensions HOT 1
- Missing USelectMenu selected option name HOT 9
- Problem with error message translations if use valibot in form HOT 2
- Hide wrapper of UInput when type="hidden"
- space between buttons in buttonGroup OR more styles for RadioGroup HOT 3
- Hide CommandPalette empty state not working HOT 1
- Allow URadio to accept a type of object
- Button group rounded corner SSR mismatch HOT 1
- UToggle is not getting rerendered when v-model is getting from pinia store
- Loading property for UDropdown Items
- Breadcrumb: use custom action instead of link HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ui.