WlPopover
Placement
Full example
<script setup lang="ts">
import { WlButton, WlDatePicker, WlDialog, WlPopover, type WlPopoverExpose, WlSelect } from "legato-ui";
import { ref } from "vue";
const popover = ref<WlPopoverExpose | null>(null);
const dialogPopover = ref<WlPopoverExpose | null>(null);
const dialogVisible = ref(false);
const type = ref<string | null>("all");
const dialogType = ref<string | null>("all");
const dialogDate = ref<string | null>("2026-10-05");
const options = [
{ label: "All materials", value: "all" },
{ label: "Task deadlines", value: "task_deadline" }
];
</script>
<template>
<div class="wl-stack" data-space="md">
<WlButton @click="popover?.toggle($event)">{{ "Details" }}</WlButton>
<WlPopover
ref="popover"
aria-label="Material details"
placement="bottom"
align="center"
arrow
>
<div class="wl-stack" data-space="md">
<p class="wl-text-body">{{ "The panel opens next to the button." }}</p>
<div class="wl-inline" data-space="md">
<WlSelect
v-model="type"
:options="options"
option-label="label"
option-value="value"
aria-label="Material type"
/>
<WlButton size="sm" @click="popover?.hide()">{{ "Close" }}</WlButton>
</div>
</div>
</WlPopover>
<WlPopover
trigger="hover"
placement="right"
arrow
aria-label="Material details"
>
<template #trigger="{ attrs }">
<WlButton v-bind="attrs" variant="ghost">{{ "Material details" }}</WlButton>
</template>
<p class="wl-text-body">{{ "The panel opens next to the button." }}</p>
</WlPopover>
<output aria-label="Selected type" class="wl-text-body">{{ type }}</output>
<WlButton @click="dialogVisible = true">{{ "Nested filters" }}</WlButton>
<WlDialog v-model:visible="dialogVisible" header="Nested filters">
<div class="wl-stack" data-space="md">
<div><WlButton @click="dialogPopover?.toggle($event)">{{ "Open filters" }}</WlButton></div>
<WlPopover ref="dialogPopover" aria-label="Filters in a dialog">
<div class="wl-stack" data-space="md">
<WlSelect
v-model="dialogType"
:options="options"
option-label="label"
option-value="value"
aria-label="Type in dialog"
/>
<WlDatePicker v-model="dialogDate" aria-label="Date in dialog" />
<div><WlButton size="sm">{{ "Button inside filters" }}</WlButton></div>
</div>
</WlPopover>
<dl class="wl-inline" data-space="lg">
<div class="wl-stack" data-space="xs">
<dt class="wl-text-small wl-text-muted">{{ "Type" }}</dt>
<dd><output aria-label="Selected type in dialog" class="wl-text-body">{{ dialogType }}</output></dd>
</div>
<div class="wl-stack" data-space="xs">
<dt class="wl-text-small wl-text-muted">{{ "Date" }}</dt>
<dd><output aria-label="Selected date in dialog" class="wl-text-body">{{ dialogDate }}</output></dd>
</div>
</dl>
</div>
<template #footer><WlButton @click="dialogVisible = false">{{ "Done" }}</WlButton></template>
</WlDialog>
</div>
</template>Behavior
Full example
<script setup lang="ts">
import { WlButton, WlDatePicker, WlDialog, WlPopover, type WlPopoverExpose, WlSelect } from "legato-ui";
import { ref } from "vue";
const popover = ref<WlPopoverExpose | null>(null);
const dialogPopover = ref<WlPopoverExpose | null>(null);
const dialogVisible = ref(false);
const type = ref<string | null>("all");
const dialogType = ref<string | null>("all");
const dialogDate = ref<string | null>("2026-10-05");
const options = [
{ label: "All materials", value: "all" },
{ label: "Task deadlines", value: "task_deadline" }
];
</script>
<template>
<div class="wl-stack" data-space="md">
<WlButton @click="popover?.toggle($event)">{{ "Details" }}</WlButton>
<WlPopover
ref="popover"
aria-label="Material details"
placement="bottom"
align="center"
arrow
>
<div class="wl-stack" data-space="md">
<p class="wl-text-body">{{ "The panel opens next to the button." }}</p>
<div class="wl-inline" data-space="md">
<WlSelect
v-model="type"
:options="options"
option-label="label"
option-value="value"
aria-label="Material type"
/>
<WlButton size="sm" @click="popover?.hide()">{{ "Close" }}</WlButton>
</div>
</div>
</WlPopover>
<WlPopover
trigger="hover"
placement="right"
arrow
aria-label="Material details"
>
<template #trigger="{ attrs }">
<WlButton v-bind="attrs" variant="ghost">{{ "Material details" }}</WlButton>
</template>
<p class="wl-text-body">{{ "The panel opens next to the button." }}</p>
</WlPopover>
<output aria-label="Selected type" class="wl-text-body">{{ type }}</output>
<WlButton @click="dialogVisible = true">{{ "Nested filters" }}</WlButton>
<WlDialog v-model:visible="dialogVisible" header="Nested filters">
<div class="wl-stack" data-space="md">
<div><WlButton @click="dialogPopover?.toggle($event)">{{ "Open filters" }}</WlButton></div>
<WlPopover ref="dialogPopover" aria-label="Filters in a dialog">
<div class="wl-stack" data-space="md">
<WlSelect
v-model="dialogType"
:options="options"
option-label="label"
option-value="value"
aria-label="Type in dialog"
/>
<WlDatePicker v-model="dialogDate" aria-label="Date in dialog" />
<div><WlButton size="sm">{{ "Button inside filters" }}</WlButton></div>
</div>
</WlPopover>
<dl class="wl-inline" data-space="lg">
<div class="wl-stack" data-space="xs">
<dt class="wl-text-small wl-text-muted">{{ "Type" }}</dt>
<dd><output aria-label="Selected type in dialog" class="wl-text-body">{{ dialogType }}</output></dd>
</div>
<div class="wl-stack" data-space="xs">
<dt class="wl-text-small wl-text-muted">{{ "Date" }}</dt>
<dd><output aria-label="Selected date in dialog" class="wl-text-body">{{ dialogDate }}</output></dd>
</div>
</dl>
</div>
<template #footer><WlButton @click="dialogVisible = false">{{ "Done" }}</WlButton></template>
</WlDialog>
</div>
</template>Panel next to a button
Toggle/hide, content and action, ariaLabel, motion and open/close events.
Popover closed.
Full example
<script setup lang="ts">
import { WlButton, WlCheckbox, WlPopover, type WlPopoverExpose, WlTag } from "legato-ui";
import { ref } from "vue";
const panel = ref<WlPopoverExpose | null>(null);
const motion = ref(true);
const message = ref("Popover closed.");
</script>
<template>
<div class="wl-stack" data-space="lg">
<WlCheckbox v-model="motion">{{ "Popover animation" }}</WlCheckbox>
<div><WlButton @click="panel?.toggle($event)">{{ "Material details" }}</WlButton></div>
<WlPopover
ref="panel"
aria-label="Material details"
:motion="motion"
:pt="{ root: { style: { width: 'min(320px, calc(100vw - 16px))', maxWidth: 'calc(100vw - 16px)' } } }"
@open="message = 'Popover opened.'"
@close="message = 'Popover closed.'"
>
<div class="showcase-popover wl-stack" data-space="md">
<WlTag color="green">{{ "Available to the team" }}</WlTag>
<h3 class="wl-text-subheading">{{ "Release plan" }}</h3>
<p class="wl-text-body">{{ "The panel is anchored to the button. Close it by clicking outside or pressing Escape." }}</p>
<div><WlButton size="sm" @click="panel?.hide()">{{ "Done" }}</WlButton></div>
</div>
</WlPopover>
<p class="wl-text-small" role="status">{{ message }}</p>
</div>
</template>
<style scoped>
.showcase-popover { max-width: min(280px, calc(100vw - 40px)); }
</style>Props
Types, accepted values and literal defaults come from the public manifest. Inherited settings name their source; “Not set” means no default is declared.
| Prop | Type / values | Default | Purpose |
|---|---|---|---|
dismissible | boolean | true | Close by clicking outside the popover. |
closeOnEscape | boolean | true | Close with Escape. |
ariaLabel | string | Not set | Accessible popover name. |
ariaLabelledby | string | Not set | ID of the element labelling the popover. |
motion | boolean | Inherits WlConfig.motion | Opening and closing animation; defaults to WlConfig.motion (true). |
pt | WlPt< | Not set | Attributes of internal Legato UI elements. |
placement | WlPopoverPlacement | "auto" | Preferred overlay side relative to its anchor. |
align | WlPopoverAlign | "start" | Alignment of the overlay along its anchor. |
arrow | boolean | false | Show an arrow pointing to the overlay anchor. |
trigger | WlPopoverTrigger | "manual" | Interaction that opens the popover; manual mode uses its exposed methods. |
Events
| Event | Payload | When emitted |
|---|---|---|
open | [] | Popover opened. |
close | [] | Popover closed. |
afterLeave | [] | Emitted after the closing transition has completed. |
Slots
| Slot | Type / values | Content |
|---|---|---|
default | default?(props: {}): unknown; | Popover content. |
trigger | trigger?(props: WlPopoverTriggerSlotProps): unknown; | Custom trigger; bind its supplied attributes and use the provided open/close actions. |
Pass-through: pt
Sections WlPopover are listed below. Attributes merge in this order: createWlPt() WlConfig.ptpt instance. Class and style merge; the last supplied value takes priority for other attributes.
| Section | DOM | Purpose |
|---|---|---|
arrow | span.wl-popover__arrow | Decorative arrow pointing to the trigger. |
content | div.wl-popover__content | The content section in WlConfig.pt.popover configuration. |
root | div.wl-popover | The root section in WlConfig.pt.popover configuration. |
Sections refer to the component DOM. Dotted names identify a configuration group and its section; composite parts use their own pt groups. Global and local attributes merge, with class and style added together.
Keyboard and accessibility
- Pass ariaLabel/ariaLabelledby and open the panel from a real button, passing the event to toggle/show.
- The popover is non-modal and does not trap focus. Its interactive content needs clear names and Tab order.
- Escape closes the panel and returns focus to the trigger; dismissible controls closing by clicking outside.
Keyboard and application responsibilities
| Key | Action |
|---|---|
| Tab / Shift+Tab | Move between controls; modal overlays retain focus inside. |
| Escape | Dismiss the top eligible overlay when dismissal is enabled. |
Provide a meaningful accessible name and connect labels, hints and errors to the focusable element. Check the behavior with your own data and a screen reader.
WAI-ARIA Authoring PracticesIn your application, check keyboard controls, zoom and focus visibility. State labels and required information must be readable in every theme.