WlDrawer
Placement
Full example
<div class="wl-stack" data-space="md">
<WlButton @click="visible = true">{{ "Open drawer" }}</WlButton><WlDrawer
v-model:visible="visible"
header="About the material"
size="md"
:dismissible="true"
>
<p class="wl-text-body">{{ "Material details appear over the page." }}</p>
<template #footer><WlButton @click="visible = false">{{ "Done" }}</WlButton></template>
</WlDrawer>
</div>Behavior
Full example
<div class="wl-stack" data-space="md">
<WlButton @click="visible = true">{{ "Open drawer" }}</WlButton><WlDrawer
v-model:visible="visible"
header="About the material"
size="md"
:dismissible="true"
>
<p class="wl-text-body">{{ "Material details appear over the page." }}</p>
<template #footer><WlButton @click="visible = false">{{ "Done" }}</WlButton></template>
</WlDrawer>
</div>Panel positions
Right/left/top/bottom/full, controlled animation, details and footer actions.
Open the drawer from any side.
Full example
<script setup lang="ts">
import { WlButton, WlCheckbox, WlDrawer, type WlDrawerPosition, WlTag } from "legato-ui";
import { ref } from "vue";
const visible = ref(false);
const position = ref<WlDrawerPosition>("right");
const motion = ref(true);
const saved = ref(false);
const positions = { right: "Right", left: "Left", top: "Top", bottom: "Bottom", full: "Full screen" } satisfies Record<WlDrawerPosition, string>;
function open(value: WlDrawerPosition): void {
position.value = value;
visible.value = true;
}
</script>
<template>
<div class="wl-stack" data-space="lg">
<WlCheckbox v-model="motion">{{ "Drawer animation" }}</WlCheckbox>
<div class="wl-inline" data-space="sm"><WlButton
v-for="(label, key) in positions"
:key="key"
size="sm"
@click="open(key)"
>{{ label }}</WlButton></div>
<WlDrawer
v-model:visible="visible"
header="Material details"
:position="position"
:motion="motion"
:pt="{ footer: { style: { flexWrap: 'wrap' } } }"
>
<div class="wl-stack" data-space="md">
<WlTag color="blue">{{ "Draft" }}</WlTag>
<h3 class="wl-text-subheading">{{ "Release plan" }}</h3>
<p class="wl-text-body">
{{ "Drawer" }} {{ positions[position] }}
{{ "contains the details; its footer holds the actions. Escape and the close button return to the page." }}
</p>
</div>
<template #footer>
<WlButton @click="visible = false">{{ "Close details" }}</WlButton>
<WlButton variant="primary" @click="saved = true; visible = false">{{ "Save details" }}</WlButton>
</template>
</WlDrawer>
<p class="wl-text-small" role="status">
{{ saved ? "Details saved in the local example." : "Open the drawer from any side." }}
</p>
</div>
</template>Props
Types, accepted values and literal defaults come from the public manifest. Inherited settings name their source; “Not set” means no default is declared.
v-model:visible: booleanv-model:visible — whether open (default false).
| Prop | Type / values | Default | Purpose |
|---|---|---|---|
header | string | Not set | Heading (when no header slot is provided). |
position | WlDrawerPosition | "right" | Opening side. |
modal | boolean | true | Modal mode with backdrop. |
dismissible | boolean | true | Close by clicking the backdrop. |
closeOnEscape | boolean | true | Close with Escape. |
blockScroll | boolean | true | Locks page scrolling while the panel is open. |
ariaLabel | string | Not set | Accessible panel name without a text heading. |
ariaLabelledby | string | Not set | ID of the element labelling the panel. |
motion | boolean | Inherits WlConfig.motion | Opening and closing animation; defaults to WlConfig.motion (true). |
pt | WlPt< | Not set | Attributes of internal Legato UI elements. |
closable | boolean | true | Show the explicit close action. |
size | WlOverlaySize | Not set | Size within the component family's documented scale. |
width | string | | Not set | Explicit surface width as a CSS length or a pixel number. |
initialFocus | WlOverlayInitialFocus | Not set | Initial focus policy or target for the opened modal surface. |
Events
| Event | Payload | When emitted |
|---|---|---|
open | [] | Panel fully opened. |
close | [] | Panel closed. |
afterLeave | [] | Emitted after the closing transition has completed. |
update:visible | boolean | Emitted when the component requests a model change; the payload is the next value. |
Slots
| Slot | Type / values | Content |
|---|---|---|
default | default?(props: {}): unknown; | Panel content. |
header | header?(props: {}): unknown; | Custom header. |
footer | footer?(props: {}): unknown; | Footer. |
Pass-through: pt
Sections WlDrawer 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 |
|---|---|---|
mask | div.wl-drawer-mask | The mask section in WlConfig.pt.drawer configuration. |
root | aside.wl-drawer | The root section in WlConfig.pt.drawer configuration. |
header | header.wl-drawer__header | The header section in WlConfig.pt.drawer configuration. |
title | span.wl-drawer__title | The title section in WlConfig.pt.drawer configuration. |
closeButton.root | button.wl-overlay-close | Button that closes the surface. |
closeButton.icon | span | Decorative icon inside the close button. |
content | div.wl-drawer__content | The content section in WlConfig.pt.drawer configuration. |
footer | footer.wl-drawer__footer | The footer section in WlConfig.pt.drawer 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
- The panel needs an accessible name through header or ariaLabel/ariaLabelledby; its opening side does not change its meaning.
- The modal panel traps focus; Escape, the close button and an enabled backdrop return to the page.
- Save and cancel are explicit footer actions. Control visible in the application and check reopening in every required position.
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 PracticesChanges are emitted through v-model:visible. After selection, cancellation and reset, labels and states must remain clear.
In your application, check keyboard controls, zoom and focus visibility. State labels and required information must be readable in every theme.