Usage
Use a Button or any other component in the default slot of the Popover.
Then, use the #content slot to add the content displayed when the Popover is open.
<template>
<B24Popover>
<B24Button label="Open" />
<template #content>
<Placeholder class="size-48 m-4 inline-flex" />
</template>
</B24Popover>
</template>
Mode
Use the mode prop to change the mode of the Popover. Defaults to click.
<template>
<B24Popover mode="hover">
<B24Button label="Open" />
<template #content>
<Placeholder class="size-48 m-4 inline-flex" />
</template>
</B24Popover>
</template>
Delay
When using the hover mode, you can use the open-delay and close-delay props to control the delay before the Popover is opened or closed.
<template>
<B24Popover mode="hover" :open-delay="500" :close-delay="300">
<B24Button label="Open" />
<template #content>
<Placeholder class="size-48 m-4 inline-flex" />
</template>
</B24Popover>
</template>
Content
Use the content prop to control how the Popover content is rendered, like its align or side for example.
<template>
<B24Popover
:content="{
align: 'center',
side: 'bottom',
sideOffset: 8
}"
>
<B24Button label="Open" />
<template #content>
<Placeholder class="size-48 m-4 inline-flex" />
</template>
</B24Popover>
</template>
Arrow
Use the arrow prop to display an arrow on the Popover.
<template>
<B24Popover arrow>
<B24Button label="Open" />
<template #content>
<Placeholder class="size-48 m-4 inline-flex" />
</template>
</B24Popover>
</template>
Modal
Use the modal prop to control whether the Popover blocks interaction with outside content. Defaults to false.
<template>
<B24Popover modal>
<B24Button label="Open" />
<template #content>
<Placeholder class="size-48 m-4 inline-flex" />
</template>
</B24Popover>
</template>
Dismissible
Use the dismissible prop to control whether the Popover is dismissible when clicking outside of it or pressing escape. Defaults to true.
close:prevent event will be emitted when the user tries to close it.Examples
Control open state
You can control the open state by using the default-open prop or the v-model:open directive.
defineShortcuts, you can toggle the Popover by pressing O.With command palette
You can use a CommandPalette component inside the Popover's content.
With following cursor
You can make the Popover follow the cursor when hovering over an element using the reference prop:
With anchor slot
You can use the #anchor slot to position the Popover against a custom element.
mode is click.API
Props
Slots
close function is only available when mode is set to click because Reka UI exposes this for Popover but not for HoverCard.Emits
Theme
export default defineAppConfig({
b24ui: {
popover: {
slots: {
content: 'base-mode bg-(--ui-color-bg-content-primary) shadow-(--popup-window-box-shadow) rounded-(--ui-border-radius-xl) will-change-[opacity] motion-safe:data-[state=open]:animate-[scale-in_100ms_ease-out] motion-safe:data-[state=closed]:animate-[scale-out_100ms_ease-in] origin-(--reka-popover-content-transform-origin) focus:outline-none pointer-events-auto',
arrow: 'fill-(--ui-color-bg-content-primary)'
}
}
}
})
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import bitrix24UIPluginVite from '@bitrix24/b24ui-nuxt/vite'
export default defineConfig({
plugins: [
vue(),
bitrix24UIPluginVite({
b24ui: {
popover: {
slots: {
content: 'base-mode bg-(--ui-color-bg-content-primary) shadow-(--popup-window-box-shadow) rounded-(--ui-border-radius-xl) will-change-[opacity] motion-safe:data-[state=open]:animate-[scale-in_100ms_ease-out] motion-safe:data-[state=closed]:animate-[scale-out_100ms_ease-in] origin-(--reka-popover-content-transform-origin) focus:outline-none pointer-events-auto',
arrow: 'fill-(--ui-color-bg-content-primary)'
}
}
}
})
]
})