Drawer
weekendsuperhero-io-sistine/drawerUnverifiedComponent
A drawer component for mobile with optional glass material.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/Weekendsuperhero-io/sistine/main/drawer.jsonSource
1"use client";23import * as React from "react";4import { Drawer as DrawerPrimitive } from "vaul";56import { type MaterialAxisProps, materialSurface, splitAxisProps } from "@/lib/material";7import { cn } from "@/lib/utils";89/* Role: borderless adaptive glass. */10const ROLE = {};1112const Drawer = ({ shouldScaleBackground = true, ...props }: React.ComponentProps<typeof DrawerPrimitive.Root>) => (13 <DrawerPrimitive.Root data-slot="drawer" shouldScaleBackground={shouldScaleBackground} {...props} />14);15Drawer.displayName = "Drawer";1617const DrawerTrigger = DrawerPrimitive.Trigger;1819const DrawerPortal = DrawerPrimitive.Portal;2021const DrawerClose = DrawerPrimitive.Close;2223const DrawerOverlay = React.forwardRef<24 React.ElementRef<typeof DrawerPrimitive.Overlay>,25 React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Overlay>26>(({ className, ...props }, ref) => (27 <DrawerPrimitive.Overlay28 ref={ref}29 data-slot="drawer-overlay"30 className={cn("fixed inset-0 z-50 bg-transparent backdrop-blur-md", className)}31 {...props}32 />33));34DrawerOverlay.displayName = DrawerPrimitive.Overlay.displayName;3536const DrawerContent = React.forwardRef<37 React.ElementRef<typeof DrawerPrimitive.Content>,38 React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Content> &39 MaterialAxisProps & {40 variant?: "default" | "glass";41 }42>(({ className, children, variant = "glass", ...props }, ref) => {43 const [axes, rest] = splitAxisProps(props);44 /* Variant classes carry BEHAVIOR only; the surface comes from materialSurface. */45 const variants = {46 default: "bg-background",47 glass: "text-foreground",48 };4950 const m = materialSurface(variant === "default" ? null : ROLE, axes);5152 return (53 <DrawerPortal data-slot="drawer-portal">54 <DrawerOverlay />55 <DrawerPrimitive.Content56 ref={ref}57 data-slot="drawer-content"58 data-material={m?.["data-material"]}59 className={cn(60 m?.className,61 "group/drawer-content fixed z-50 flex h-auto flex-col",62 "data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-xl data-[vaul-drawer-direction=top]:border-b",63// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from weekendsuperhero-io/sistine
All 71 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | weekendsuperhero-io/sistine | Components | Unverified | 5 deps · 4 files | |
| Alertalert | weekendsuperhero-io/sistine | Components | Unverified | 3 deps · 4 files | |
| Alert Dialogalert-dialog | weekendsuperhero-io/sistine | Components | Unverified | 4 deps · 4 files | |
| Auto Foregroundauto-foreground | weekendsuperhero-io/sistine | Components | Unverified | no deps | |
| Avataravatar | weekendsuperhero-io/sistine | Components | Unverified | 4 deps · 4 files | |
| Badgebadge | weekendsuperhero-io/sistine | Components | Unverified | 4 deps · 4 files | |
| Breadcrumbbreadcrumb | weekendsuperhero-io/sistine | Components | Unverified | 5 deps · 4 files | |
| Buttonbutton | weekendsuperhero-io/sistine | Components | Unverified | 4 deps · 4 files |
