docs(popover): add panel slot example

Resolves #763
This commit is contained in:
Benjamin Canac
2023-10-03 14:54:58 +02:00
parent 25ab781c14
commit 498db5ca21
2 changed files with 33 additions and 1 deletions

View File

@@ -0,0 +1,11 @@
<template>
<UPopover>
<UButton color="white" label="Open" trailing-icon="i-heroicons-chevron-down-20-solid" />
<template #panel="{ close }">
<div class="p-8">
<UButton label="Close" @click="close" />
</div>
</template>
</UPopover>
</template>

View File

@@ -14,6 +14,7 @@ links:
::component-example
#default
:popover-example
#code
```vue
<template>
@@ -53,7 +54,27 @@ Use the `mode` prop to switch between `click` and `hover` modes.
### `panel`
Use the `#panel` slot to fill the content of the panel.
Use the `#panel` slot to fill the content of the panel. You will have access to the `open` property and the `close` method in the slot scope.
::component-example
#default
:popover-example-slot
#code
```vue
<template>
<UPopover>
<UButton color="white" label="Open" trailing-icon="i-heroicons-chevron-down-20-solid" />
<template #panel="{ close }">
<div class="p-8">
<UButton label="Close" @click="close" />
</div>
</template>
</UPopover>
</template>
```
::
## Props