shadimage
corr
componentaction-drawersource: ok · hit

Drawer

A mobile-friendly drawer wrapper with title, description, content, and footer actions.

npx shadcn add "https://ui.corr.sh/r/action-drawer.json"
free

Where it goes

footer

Tags auto-generated by rules on 9/24/2026 — empty means no evidence, not lack of support.

Dependencies

Bundle weight · light

Registry dependencies

buttondrawerinput

Files1 · source cached 10/15/2026, 8:00:40 AM

registry/corr/components/action-drawer.tsx
import type { ReactNode } from "react"

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

export function ActionDrawer({
  trigger,
  title,
  description,
  children,
  actionLabel = "Save",
  cancelLabel = "Cancel",
  direction = "bottom",
  onAction,
}: {
  trigger: ReactNode
  title: string
  description?: string
  children?: ReactNode
  actionLabel?: string
  cancelLabel?: string
  direction?: "top" | "right" | "bottom" | "left"
  onAction?: () => void
}) {
  return (
    <Drawer direction={direction}>
      <DrawerTrigger asChild>{trigger}</DrawerTrigger>
      <DrawerContent>
        <div className="mx-auto w-full max-w-md group-data-[vaul-drawer-direction=left]/drawer-content:mx-0 group-data-[vaul-drawer-direction=right]/drawer-content:mx-0">
          <DrawerHeader>
            <DrawerTitle>{title}</DrawerTitle>
            {description ? (
              <DrawerDescription>{description}</DrawerDescription>
            ) : null}
          </DrawerHeader>
          {children ? <div className="px-4 text-sm">{children}</div> : null}
          <DrawerFooter>
            <DrawerClose asChild>
              <Button onClick={onAction}>{actionLabel}</Button>
            </DrawerClose>
            <DrawerClose asChild>
              <Button variant="outline">{cancelLabel}</Button>
            </DrawerClose>
          </DrawerFooter>
        </div>
      </DrawerContent>
    </Drawer>
  )
}

More from corr

Browse all components in this library →