Drawer
blode-ui/drawerFreeComponent
A panel that slides in from the edge of the screen.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/mblode/blode-ui/main/public/r/drawer.jsonSource
1"use client";23import { Drawer as DrawerPrimitive } from "@base-ui/react/drawer";4import * as React from "react";56import { cn } from "@/lib/utils";78const Drawer = ({ ...props }: DrawerPrimitive.Root.Props) => (9 <DrawerPrimitive.Root data-slot="drawer" {...props} />10);1112const DrawerTrigger = ({13 asChild,14 children,15 ...props16}: DrawerPrimitive.Trigger.Props & {17 asChild?: boolean;18}) => {19 if (asChild && React.isValidElement(children)) {20 return <DrawerPrimitive.Trigger data-slot="drawer-trigger" render={children} {...props} />;21 }2223 return (24 <DrawerPrimitive.Trigger data-slot="drawer-trigger" {...props}>25 {children}26 </DrawerPrimitive.Trigger>27 );28};2930const DrawerPortal = ({ ...props }: DrawerPrimitive.Portal.Props) => (31 <DrawerPrimitive.Portal data-slot="drawer-portal" {...props} />32);3334const DrawerClose = ({35 asChild,36 children,37 ...props38}: DrawerPrimitive.Close.Props & {39 asChild?: boolean;40}) => {41 if (asChild && React.isValidElement(children)) {42 return <DrawerPrimitive.Close data-slot="drawer-close" render={children} {...props} />;43 }4445 return (46 <DrawerPrimitive.Close data-slot="drawer-close" {...props}>47 {children}48 </DrawerPrimitive.Close>49 );50};5152const DrawerBackdrop = ({ className, ...props }: DrawerPrimitive.Backdrop.Props) => (53 <DrawerPrimitive.Backdrop54 className={cn(55 "data-closed:fade-out-0 data-open:fade-in-0 fixed inset-0 z-50 bg-overlay backdrop-blur-[10px] data-closed:animate-out data-open:animate-in data-closed:duration-300 data-open:duration-500 motion-reduce:transition-none",56 className,57 )}58 data-slot="drawer-overlay"59 {...props}60 />61);6263const DrawerOverlay = DrawerBackdrop;6465const DrawerViewport = ({ className, ...props }: DrawerPrimitive.Viewport.Props) => (66 <DrawerPrimitive.Viewport67 className={cn("fixed inset-0 z-50 outline-none", className)}68 data-slot="drawer-viewport"69 {...props}70 />71);7273const DrawerPopup = ({ className, ...props }: DrawerPrimitive.Popup.Props) => (74 <DrawerPrimitive.Popup75 className={cn(76 "group/drawer-content fixed z-50 flex h-auto flex-col bg-background shadow-lg transition ease-in-out data-closed:animate-out data-open:animate-in data-closed:duration-300 data-open:duration-500",77// … truncated
What it pulls in
npm packages
Files it writes
More from blode/ui
All 85 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | blode/ui | Components | Free | 2 deps | |
| Alertalert | blode/ui | Components | Free | no deps | |
| Alert Dialogalert-dialog | blode/ui | Components | Free | 1 dep | |
| Ask User Questionsask-user-questions | blode/ui | Components | Free | 1 dep | |
| Aspect Ratioaspect-ratio | blode/ui | Components | Free | 1 dep | |
| Attachmentattachment | blode/ui | Components | Free | 1 dep | |
| Autocompleteautocomplete | blode/ui | Components | Free | 1 dep | |
| Avataravatar | blode/ui | Components | Free | 1 dep |
