side choisit le bord. start et end suivent le sens d’écriture.
vue
<script setup lang="ts">
import { ref } from 'vue'
import { VButton, VDrawer, VTypography } from 'vectis-ui'
import type { DrawerSide } from 'vectis-ui'
const SIDES: DrawerSide[] = ['start', 'end', 'top', 'bottom']
const opened = ref<DrawerSide | null>(null)
</script>
<template>
<div class="row">
<VButton
v-for="side in SIDES"
:key="side"
variant="outline"
tone="neutral"
@click="opened = side"
>
{{ side }}
</VButton>
</div>
<VDrawer
v-for="side in SIDES"
:key="side"
:side="side"
:open="opened === side"
:title="`From ${side}`"
subtitle="The drawer slides in from this edge."
@update:open="(value) => !value && (opened = null)"
>
<VTypography>
In a right-to-left page, start is the right edge and end the left one.
</VTypography>
</VDrawer>
</template>
<style scoped>
.row {
display: flex;
flex-wrap: wrap;
gap: var(--vectis-space-2);
}
</style>
Taille
size définit la largeur d’un tiroir latéral, ou la hauteur d’un tiroir en haut ou en bas. extent la remplace par n’importe quelle longueur CSS. Une bande de la page reste toujours découverte.
vue
<script setup lang="ts">
import { ref } from 'vue'
import { VButton, VDrawer, VTypography } from 'vectis-ui'
import type { DrawerSize } from 'vectis-ui'
const SIZES: DrawerSize[] = ['sm', 'md', 'lg']
const opened = ref<string | null>(null)
</script>
<template>
<div class="row">
<VButton
v-for="size in SIZES"
:key="size"
variant="outline"
tone="neutral"
@click="opened = size"
>
{{ size }}
</VButton>
<VButton variant="outline" tone="neutral" @click="opened = 'extent'">extent="50vw"</VButton>
</div>
<VDrawer
v-for="size in SIZES"
:key="size"
:size="size"
:open="opened === size"
:title="`Size ${size}`"
@update:open="(value) => !value && (opened = null)"
>
<VTypography>On a narrow screen the drawer leaves a strip of the page uncovered.</VTypography>
</VDrawer>
<VDrawer
extent="50vw"
:open="opened === 'extent'"
title="Half the viewport"
@update:open="(value) => !value && (opened = null)"
>
<VTypography>The extent is a CSS length, in any unit.</VTypography>
</VDrawer>
</template>
<style scoped>
.row {
display: flex;
flex-wrap: wrap;
gap: var(--vectis-space-2);
}
</style>
Navigation
Le corps défile tandis que l’en-tête et le pied restent visibles. Fermez le tiroir quand un élément est sélectionné.