Drawer/drawer-top-

PreviousNext

A drawer/drawer-top- example

Docs
shadcnblocksblock

Preview

Loading preview…
code/example/drawer/drawer-top-1.tsx
"use client";

import { Button } from "@/components/ui/button";
import {
  Drawer,
  DrawerClose,
  DrawerContent,
  DrawerDescription,
  DrawerFooter,
  DrawerHeader,
  DrawerTitle,
  DrawerTrigger,
} from "@/components/ui/drawer";

export const title = "Simple Top Drawer";

const Example = () => (
  <Drawer direction="top">
    <DrawerTrigger asChild>
      <Button variant="outline">Open Top Drawer</Button>
    </DrawerTrigger>
    <DrawerContent>
      <DrawerHeader>
        <DrawerTitle>Top Drawer</DrawerTitle>
        <DrawerDescription>
          This drawer slides down from the top.
        </DrawerDescription>
      </DrawerHeader>
      <div className="p-4">
        <p className="text-sm text-muted-foreground">
          Top drawers are useful for search bars, notifications, and quick
          action panels.
        </p>
      </div>
      <DrawerFooter>
        <DrawerClose asChild>
          <Button variant="outline">Close</Button>
        </DrawerClose>
      </DrawerFooter>
    </DrawerContent>
  </Drawer>
);

export default Example;

Installation

npx shadcn@latest add @shadcnblocks/drawer-drawer-top-1

Usage

import { DrawerDrawerTop1 } from "@/components/drawer-drawer-top-1"
<DrawerDrawerTop1 />