Giter VIP home page Giter VIP logo

Comments (5)

benjamincanac avatar benjamincanac commented on June 18, 2024 1

Wouldn't it be simpler to use a Popover for this? https://ui.nuxt.com/components/popover

from ui.

Whbbit1999 avatar Whbbit1999 commented on June 18, 2024

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.

andyjamesn avatar andyjamesn commented on June 18, 2024

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.

2024-05-10 13 26 01

Is there a way to prevent the dropdown closing on click?

from ui.

Whbbit1999 avatar Whbbit1999 commented on June 18, 2024

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.

andyjamesn avatar andyjamesn commented on June 18, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.