Components
Mobile Drawer
The Drawer component exposed with mobile naming.
Installation
$ npx veil-ui@latest add mobile-drawerUsage
import {
MobileDrawer,
MobileDrawerContent,
MobileDrawerTrigger,
} from "@/components/ui/mobile-drawer";
<MobileDrawer>
<MobileDrawerTrigger asChild>
<Button>Open menu</Button>
</MobileDrawerTrigger>
<MobileDrawerContent side="left">{menu}</MobileDrawerContent>
</MobileDrawer>;Examples
Basic
Right
API reference
The package exports mobile-drawer along with its composable parts. It forwards standard attributes to its root element; see the examples above for the component-specific props.
Accessibility
- Touch targets are large enough to tap comfortably and keep visible focus rings for keyboard and switch users.
- Gesture interactions (swipe, pull to refresh) have visible button alternatives so they are not the only way to act.
- Sheets, drawers and dialogs follow the underlying accessible primitives for focus trapping and escape handling.
Vue and plain HTML
This component also ships for Vue (Reka UI) and plain HTML. Install it with npx veil-ui add mobile-drawer --framework vue or switch the framework in components.json.
<script setup lang="ts">
import { Drawer } from "@/components/ui/drawer";
const props = defineProps<{
open?: boolean;
defaultOpen?: boolean;
modal?: boolean;
}>();
const emit = defineEmits<{ "update:open": [value: boolean] }>();
</script>
<template>
<Drawer
:open="props.open"
:default-open="props.defaultOpen"
:modal="props.modal"
@update:open="emit('update:open', $event)"
>
<slot />
</Drawer>
</template>