UniqueUI

Drawer Slide

Slide-out drawer panel with drag-to-dismiss, spring physics, and backdrop blur.

npx uniqueui add drawer-slide

Preview

Usage

"use client";
import { useState } from "react";
import { DrawerSlide } from "@/components/ui/drawer-slide";

export default function Example() {
  const [drawerOpen, setDrawerOpen] = useState(false);
  return (
    <>
      <div className="flex items-center justify-center p-20">
        <button
          onClick={() => setDrawerOpen(true)}
          className="px-6 py-3 rounded-lg bg-purple-600 hover:bg-purple-500 text-white transition-colors font-medium"
        >
          Open Drawer
        </button>
      </div>
      <DrawerSlide isOpen={drawerOpen} onClose={() => setDrawerOpen(false)}>
        <h3 className="text-xl font-bold mb-4 text-white">Drawer Content</h3>
        <p className="text-neutral-400 mb-4">
          This drawer slides in from the right with spring physics. You can drag it to dismiss.
        </p>
        <button
          onClick={() => setDrawerOpen(false)}
          className="px-4 py-2 rounded-lg bg-neutral-800 hover:bg-neutral-700 text-white transition-colors text-sm"
        >
          Close Drawer
        </button>
      </DrawerSlide>
    </>
  );
}

Props

PropTypeDescription
isOpenbooleanReact state abstraction determining visible rendering.
onClose() => voidMethod triggered when dismiss actions evaluation (drag, backdrop, external limit).
childrenReact.ReactNodeContent rendered inside the active sliding sheet.
positionDrawerPositionAnchoring enumeration bounding left, right, top, or bottom screen edges.
classNamestringSpecific styling modifiers passing onto the physical sliding panel.
overlayClassNamestringSpecific styling modifiers passing onto the dimming backdrop.
widthstringCSS explicit translation sizing left/right sliding panels.
heightstringCSS explicit translation sizing top/bottom sliding panels.
dragToClosebooleanMap touch swiping events onto gesture recognizers supporting drag dismiss.