WlPopover

Popover controlled imperatively through toggle/show/hide.
Components / Containers v0.1.0

Placement

all
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

all
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>