Components/Drawer
Since 1.0.0BETA

Drawer

Side panels and form surfaces

This page was migrated by AI, please review carefully

Migration is complete, but please validate against source code and manual review.

Drawer

Panels that slide in from the screen edge, ideal for settings, forms, and auxiliary content.

Basic Usage

Basic Drawer

The common drawer pattern.

Demo loads on client.

Direction

Drawers can slide in from the left or right.

Direction

Left and right drawers.

Demo loads on client.

Custom Width

Custom Width

Fixed width drawer example.

Demo loads on client.

Use the footer slot to add action buttons.

EXAMPLE.VUE
<template>
  <TxDrawer v-model:visible="visible" title="Form">
    <form>
      <input type="text" placeholder="Name" />
    </form>

    <template #footer>
      <TxButton @click="visible = false">Cancel</TxButton>
      <TxButton type="primary" @click="handleSave">Save</TxButton>
    </template>
  </TxDrawer>
</template>

Close Behavior

EXAMPLE.VUE
<template>
  <!-- Disable mask click -->
  <TxDrawer
    v-model:visible="visible"
    title="Persistent"
    :close-on-click-mask="false"
  >
    <p>Close via the button only.</p>
  </TxDrawer>

  <!-- Disable Escape close -->
  <TxDrawer
    v-model:visible="visible2"
    title="Disable Escape"
    :close-on-press-escape="false"
  >
    <p>Escape key won't close this drawer.</p>
  </TxDrawer>
</template>

Events

EXAMPLE.VUE
<template>
  <TxDrawer
    v-model:visible="visible"
    title="Event Demo"
    @open="handleOpen"
    @close="handleClose"
  >
    <p>Content</p>
  </TxDrawer>
</template>

API

Props

PropertyTypeDefaultDescription
visibleControls drawer visibility
titleTitle text
widthDrawer width
directionleftrightSlide-in direction
showCloseShow close button
closeOnClickMaskClose on mask click
closeOnPressEscapeClose on Escape key
zIndexCustom z-index

Events

PropertyTypeDefaultDescription
update:visible-Emitted on visibility change
open-Emitted when opened
close-Emitted when closed

Slots

PropertyTypeDefaultDescription
default--Main content
footer--Footer area
Was this helpful?