8-bit Drawer
8bitcn/drawerFreeComponent
A simple 8-bit drawer component
Install it
npx shadcn@latest add https://www.8bitcn.com/r/drawer.jsonSource
1import { type VariantProps, cva } from "class-variance-authority";2import { Drawer as DrawerPrimitive } from "vaul";34import { cn } from "@/lib/utils";56import {7 Drawer as ShadcnDrawer,8 DrawerClose as ShadcnDrawerClose,9 DrawerDescription as ShadcnDrawerDescription,10 DrawerFooter as ShadcnDrawerFooter,11 DrawerHeader as ShadcnDrawerHeader,12 DrawerOverlay as ShadcnDrawerOverlay,13 DrawerPortal as ShadcnDrawerPortal,14 DrawerTitle as ShadcnDrawerTitle,15 DrawerTrigger as ShadcnDrawerTrigger,16} from "@/components/ui/drawer";1718import "@/components/ui/8bit/styles/retro.css";1920const Drawer = ShadcnDrawer;2122const DrawerPortal = ShadcnDrawerPortal;2324const DrawerOverlay = ShadcnDrawerOverlay;2526const DrawerClose = ShadcnDrawerClose;2728function DrawerTitle({29 className,30 children,31 ...props32}: React.ComponentProps<typeof DrawerPrimitive.Title>) {33 return (34 <ShadcnDrawerTitle className={cn(className, "retro")} {...props}>35 {children}36 </ShadcnDrawerTitle>37 );38}3940function DrawerDescription({41 className,42 children,43 ...props44}: React.ComponentProps<typeof DrawerPrimitive.Description>) {45 return (46 <ShadcnDrawerDescription className={cn(className, "retro")} {...props}>47 {children}48 </ShadcnDrawerDescription>49 );50}5152function DrawerTrigger({53 className,54 children,55 asChild,56 ...props57}: React.ComponentProps<typeof DrawerPrimitive.Trigger>) {58 return (59 <ShadcnDrawerTrigger60 className={cn(61 // Only apply default trigger styling when NOT using asChild62 !asChild &&63 "border-foreground dark:border-ring hover:bg-transparent active:bg-transparent focus:bg-transparent rounded-none border-4 focus:border-foreground hover:border-foreground dark:focus:border-ring bg-transparent data-[state=open]:bg-transparent data-[state=open]:border-foreground dark:data-[state=open]:border-ring",64 className,65 "retro"66 )}67 asChild={asChild}68 {...props}69 >70 {children}71 </ShadcnDrawerTrigger>72 );73}7475export const drawerVariants = cva("", {76 variants: {77 font: {78 normal: "",79 retro: "retro",80 },81 },82 defaultVariants: {83 font: "retro",84 },85});8687export type DrawerProps = React.ComponentProps<typeof DrawerPrimitive.Content> &88 VariantProps<typeof drawerVariants> & {89 side?: "right" | "bottom" | "left";90 };9192function DrawerContent({93 className,94 children,95 side = "bottom",96 ...props97}: DrawerProps) {98 return (99 <ShadcnDrawerPortal data-slot="drawer-portal">100// … truncated
What it pulls in
Other registry items
Files it writes
More from 8bitcn
All 121 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| 8-bit Accordionaccordion | 8bitcn | Components | Free | no deps · 2 files | |
| 8-bit Alertalert | 8bitcn | Components | Free | no deps · 2 files | |
| 8-bit Alert Dialogalert-dialog | 8bitcn | Components | Free | no deps · 2 files | |
| 8-bit Avataravatar | 8bitcn | Components | Free | no deps · 2 files | |
| 8-bit Badgebadge | 8bitcn | Components | Free | no deps · 2 files | |
| 8-bit Breadcrumbbreadcrumb | 8bitcn | Components | Free | no deps · 2 files | |
| 8-bit Buttonbutton | 8bitcn | Components | Free | no deps · 2 files | |
| 8-bit Button Groupbutton-group | 8bitcn | Components | Free | no deps · 4 files |
