From 9fbd1cadd4a8e0e0b6ba7075ab03de3dc3978445 Mon Sep 17 00:00:00 2001 From: shabanhr Date: Thu, 4 Dec 2025 20:27:00 +0500 Subject: [PATCH] feat(sheat): add `showCloseButton` prop to `SheetContent` to conditionally render the close button. --- apps/v4/registry/new-york-v4/ui/sheet.tsx | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/apps/v4/registry/new-york-v4/ui/sheet.tsx b/apps/v4/registry/new-york-v4/ui/sheet.tsx index 84649ad0ffd..b88c9965df5 100644 --- a/apps/v4/registry/new-york-v4/ui/sheet.tsx +++ b/apps/v4/registry/new-york-v4/ui/sheet.tsx @@ -47,9 +47,11 @@ function SheetOverlay({ function SheetContent({ className, children, + showCloseButton = true, side = "right", ...props }: React.ComponentProps & { + showCloseButton?: boolean side?: "top" | "right" | "bottom" | "left" }) { return ( @@ -60,22 +62,24 @@ function SheetContent({ className={cn( "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500", side === "right" && - "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm", + "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm", side === "left" && - "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm", + "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm", side === "top" && - "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b", + "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b", side === "bottom" && - "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t", + "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t", className )} {...props} > {children} - - - Close - + {showCloseButton && ( + + + Close + + )} )