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

Closing a UPopover #763

Closed
votming opened this issue Sep 29, 2023 · 3 comments
Closed

Closing a UPopover #763

votming opened this issue Sep 29, 2023 · 3 comments
Labels
question Further information is requested

Comments

@votming
Copy link

votming commented Sep 29, 2023

Description

Greetings!

Sorry for the silly question, but how do I close a UPopover manually (via the code)?
I'm following this article, everything is working so far and the popover is opening, but how do I close it? I have buttons within the popover, but clicking them does nothing.

The code is:

<UPopover>
   Open me!
  <template #panel>
      <UButton @click="console.log('Time to close me!')"/>
  </template>
</UPopover>

Thank you in advance!

@votming votming added the question Further information is requested label Sep 29, 2023
Copy link
Member

You can get the close method from the #panel slot:

<UPopover>
  Open me!
  <template #panel="{ close }">
      <UButton @click="close" />
  </template>
</UPopover>

@votming
Copy link
Author

votming commented Sep 29, 2023

@benjamincanac Big thanks! Works like a charm.
Is there a place where I can read about these hacks? What data I can unpack from this panel and other stuff? For example, additional actions on opening a popover? (lazy-loading data for it) I was googling for a few hours straight with no luck, so it would be very helpful.

Copy link
Member

There's still some work to do on the documentation as those informations should be available. For example, we have detailed informations on slots most of the time: https://ui.nuxt.com/data/table#slots

I'll keep this open to remember to improve the Popover slots docs.

benjamincanac added a commit that referenced this issue Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants