ComponentsNew

Motion Drawer

A side panel springs in while the menu button glides into it. Drag the panel away, tap the backdrop or press the cross to close it.

Customize

backgroundColor
accentColor

Based on Motion Drawer (MIT license) · Terms of use

More in Pro

View all

Props

15 properties
PropertyTypeDefaultDescription
childrenReactNode—Panel content, for example a menu.
widthnumber280Panel width in pixels.
direction'left' | 'right'"left"Which side the panel slides in from.
buttonOpeningVariants'merge' | 'push' | 'stay'"merge"How the menu button leaves: merges into the panel, rides away with it or fades in place.
enableDragbooleantrueThe panel can be dragged away to close it.
dragThresholdnumber0.3Share of the width you must drag for the panel to close.
backgroundColorstring"#111111"Panel color.
accentColorstring"#ffffff"Colour of the menu icon and the drawer edge line.
overlayColorstring"rgba(0, 0, 0, 0.55)"Color of the backdrop behind the panel.
containedbooleanfalsePanel and button sit inside the nearest positioned parent instead of the whole viewport.
isOpenboolean—Controlled state: whether the panel is open.
onToggle(isOpen: boolean) => void—Called on open and close.
showToggleButtonbooleantrueShow the menu button and the close cross.
animationConfig{ type?, damping?, stiffness?, duration? }—Spring settings of the slide.
classNamestring—Extra classes.

Dependencies

4 required packages

npm install motion lucide-react clsx tailwind-merge

Related components

View all