Glass Drawer
washiveil/glass-drawerFreeComponent
Bottom drawer as a rising veil with a grab handle, built on Vaul.
Install it
npx shadcn@latest add https://washiveil.alexchih.com/r/glass-drawer.jsonSource
1'use client'23import * as React from 'react'4import { Drawer as DrawerPrimitive } from 'vaul'56import { cn } from '@/lib/utils'78function GlassDrawer({ shouldScaleBackground = false, ...props }: React.ComponentProps<typeof DrawerPrimitive.Root>) {9 return <DrawerPrimitive.Root shouldScaleBackground={shouldScaleBackground} {...props} />10}11GlassDrawer.displayName = 'GlassDrawer'1213const GlassDrawerTrigger = DrawerPrimitive.Trigger1415const GlassDrawerPortal = DrawerPrimitive.Portal1617const GlassDrawerClose = DrawerPrimitive.Close1819const GlassDrawerOverlay = React.forwardRef<20 React.ComponentRef<typeof DrawerPrimitive.Overlay>,21 React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Overlay>22>(({ className, ...props }, ref) => (23 <DrawerPrimitive.Overlay24 ref={ref}25 className={cn(26 'fixed inset-0 z-50 bg-deep/20 backdrop-blur-sm dark:bg-black/40',27 className,28 )}29 {...props}30 />31))32GlassDrawerOverlay.displayName = 'GlassDrawerOverlay'3334const GlassDrawerContent = React.forwardRef<35 React.ComponentRef<typeof DrawerPrimitive.Content>,36 React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Content>37>(({ className, children, ...props }, ref) => (38 <GlassDrawerPortal>39 <GlassDrawerOverlay />40 <DrawerPrimitive.Content41 ref={ref}42 className={cn(43 // after:hidden kills vaul's overscroll extension — it is built for44 // edge-attached drawers and pokes square-cornered out of a floating one.45 'fixed inset-x-2 bottom-2 z-50 flex h-auto max-h-[85svh] flex-col rounded-3xl border border-glass-edge bg-glass-stronger backdrop-blur-2xl backdrop-saturate-150 shadow-[0_16px_48px_rgba(28,25,20,0.12)] after:hidden',46 className,47 )}48 {...props}49 >50 <div className="mx-auto mt-3 h-1.5 w-10 rounded-full bg-foreground/15" />51 {children}52 </DrawerPrimitive.Content>53 </GlassDrawerPortal>54))55GlassDrawerContent.displayName = 'GlassDrawerContent'5657function GlassDrawerHeader({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {58 return <div className={cn('grid gap-1.5 p-6 pb-0 text-center sm:text-left', className)} {...props} />59}60GlassDrawerHeader.displayName = 'GlassDrawerHeader'6162function GlassDrawerFooter({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {63 return <div className={cn('mt-auto flex flex-col gap-2 p-6', className)} {...props} />64}65GlassDrawerFooter.displayName = 'GlassDrawerFooter'6667const GlassDrawerTitle = React.forwardRef<68// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from washiveil
All 58 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Ambient Fieldambient-field | washiveil | Components | Free | no deps | |
| Chipchip | washiveil | Components | Free | 1 dep | |
| Code Badgecode-badge | washiveil | Components | Free | no deps | |
| Glass Accordionglass-accordion | washiveil | Components | Free | 2 deps | |
| Glass Alertglass-alert | washiveil | Components | Free | 1 dep | |
| Glass Alert Dialogglass-alert-dialog | washiveil | Components | Free | 1 dep | |
| Glass Aspect Ratioglass-aspect-ratio | washiveil | Components | Free | 1 dep | |
| Glass Avatarglass-avatar | washiveil | Components | Free | 1 dep |
