Skip to content

Drawer ​

Панель, выезжающая с края экрана. Используется для форм, подробных просмотров, настроек и навигации.

Basic ​

vue
<template>
  <VxDrawer v-model="show" title="Drawer" description="A basic drawer.">
    <p>Content goes here.</p>
  </VxDrawer>
</template>

Direction ​

Drawer может выезжать с любого края: right (по умолчанию), left, top или bottom.

vue
<template>
  <VxDrawer v-model="show" title="Right" direction="right" />
  <VxDrawer v-model="show" title="Left" direction="left" />
  <VxDrawer v-model="show" title="Top" direction="top" />
  <VxDrawer v-model="show" title="Bottom" direction="bottom" />
</template>

Sizes ​

Доступно пять размеров: sm, md (по умолчанию), lg, xl, full.

vue
<template>
  <VxDrawer size="sm" title="Small" />
  <VxDrawer size="md" title="Medium" />
  <VxDrawer size="lg" title="Large" />
  <VxDrawer size="xl" title="XL" />
  <VxDrawer size="full" title="Full" />
</template>

Form Drawer ​

Частый паттерн: форма внутри drawer с действиями сохранения и отмены.

vue
<template>
  <VxDrawer v-model="show" title="Edit Profile">
    <form>
      <input v-model="form.name" placeholder="Name" />
      <input v-model="form.email" placeholder="Email" />
    </form>
    <template #footer>
      <button @click="show = false">Cancel</button>
      <button @click="save">Save</button>
    </template>
  </VxDrawer>
</template>

Scrollable Content ​

Когда содержимое не помещается, тело прокручивается, а header и footer остаются на месте.

vue
<template>
  <VxDrawer v-model="show" title="Terms of Service">
    <div>Long scrollable content...</div>
    <template #footer>
      <button @click="show = false">Decline</button>
      <button @click="accept">Accept</button>
    </template>
  </VxDrawer>
</template>

Custom Header ​

vue
<template>
  <VxDrawer v-model="show">
    <template #header>
      <div class="custom-header">
        <MyIcon />
        <div>
          <h3>Task Completed</h3>
          <p>Review the details below</p>
        </div>
      </div>
    </template>
    <p>Content...</p>
  </VxDrawer>
</template>
vue
<template>
  <VxDrawer v-model="show" title="Notifications" :show-footer="false">
    <NotificationList />
  </VxDrawer>
</template>

Persistent ​

Drawer встряхивается вместо закрытия при клике на оверлей или нажатии Escape.

vue
<template>
  <VxDrawer v-model="show" persistent title="Unsaved" />
</template>

No Overlay ​

vue
<template>
  <VxDrawer v-model="show" hide-overlay title="Side Panel" />
</template>

Loading ​

vue
<template>
  <VxDrawer v-model="show" :loading="isLoading" title="Loading" />
</template>

Nested Drawers ​

Открывайте один drawer внутри другого. У каждого свой оверлей и z-index.

vue
<template>
  <VxDrawer v-model="outer" title="Settings" size="lg">
    <SettingsList @open-detail="inner = true" />
  </VxDrawer>
  <VxDrawer v-model="inner" title="Detail" size="sm">
    <DetailContent />
  </VxDrawer>
</template>

Props ​

PropTypeDefaultDescription
modelValuebooleanfalseПоказать/скрыть (v-model)
titlestring''Заголовок header
descriptionstring''Описание в header
direction'left' | 'right' | 'top' | 'bottom''right'Направление выезда
size'sm' | 'md' | 'lg' | 'xl' | 'full''md'Размер панели
closablebooleantrueПоказывать кнопку закрытия
closeOnOverlaybooleantrueЗакрывать по клику на оверлей
closeOnEscbooleantrueЗакрывать по Escape
persistentbooleanfalseВстряхивать при попытке закрыть
hideOverlaybooleanfalseБез подложки
loadingbooleanfalseОверлей загрузки
showFooterbooleantrueПоказывать footer
beforeClose() => boolean | Promise<boolean>—Guard перед закрытием
destroyOnClosebooleanfalseУничтожать содержимое при закрытии
teleportTostring'body'Цель teleport

Events ​

EventDescription
update:modelValueЗначение изменилось
closeDrawer закрыт
openedАнимация открытия завершена
closedАнимация закрытия завершена

Slots ​

SlotDescription
defaultСодержимое тела
headerПользовательский header (заменяет title/description)
footerПользовательские кнопки footer

Exposed ​

MethodDescription
close()Программное закрытие (с учётом beforeClose)