Introducing PrimeReact v11-alpha 🎉Discover Now

Drawer

Drawer is a panel component displayed as an overlay at the edges of the screen.

preview

Installation#

npx shadcn@latest add @primereact/drawer

Usage#

import { Drawer, DrawerBackdrop, DrawerClose, DrawerContent, DrawerFooter, DrawerHeader, DrawerPortal, DrawerTitle, DrawerTrigger } from '@/components/ui/drawer';
<Drawer>
    <DrawerTrigger />
    <DrawerBackdrop />
    <DrawerPortal>
        <DrawerHeader>
            <DrawerTitle />
            <DrawerClose />
        </DrawerHeader>
        <DrawerContent />
        <DrawerFooter />
    </DrawerPortal>
</Drawer>

Examples#

Basic#

A slide-in panel from the edge of the screen for contextual content.

basic-demo

Position#

The position of the drawer can be customized with the position property. The available values are left, right, top and bottom.

position-demo

Full Screen#

The full screen mode is enabled when position property is set as full.

full-screen-demo

Responsive#

The responsive mode can be enabled by adding className or style to the Drawer.Portal component.

responsive-demo

API#

Sub-Components#

See Primitive API for DrawerRoot, DrawerTrigger, DrawerBackdrop, DrawerPortal, DrawerHeader, DrawerTitle, DrawerClose, DrawerContent, DrawerFooter component documentation.

Hooks#

See Headless API for useDrawer hook documentation.

Accessibility#

See Drawer Primitive for WAI-ARIA compliance details and keyboard support.