- Accordion
- Agent Thinking
- Alert
- Alert Dialog
- Announcement
- Aspect Ratio
- Attachment
- Avatar
- Badge
- Breadcrumb
- Bubble
- Button
- Button Group
- Calendar
- Card
- Carousel
- Checkbox
- Checkbox Card
- Code Block
- Collapsible
- Color Picker
- Combobox
- Command
- Composer
- Composer Loader
- Context Menu
- Data Grid
- Data Table
- Date Picker
- Dialog
- Direction
- Drawer
- Dropdown Menu
- Empty
- Field
- File Upload
- Hover Card
- Input
- Input Group
- Input Otp
- Item
- Kbd
- Label
- Marker
- Menubar
- Message
- Message Scroller
- Meter
- Native Select
- Navigation Menu
- Number Field
- Pagination
- Period Switcher
- Popover
- Progress
- Questionnaire
- Radio Card
- Radio Group
- Resizable
- Reveal
- Scroll Area
- Search Field
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Social Button
- Sonner
- Spinner
- Status Dot
- Switch
- Switch Card
- Table
- Tabs
- Tag Group
- Textarea
- Theme Toggle
- Time Field
- Toggle
- Toggle Group
- Tooltip
- Trace
- Tree View
- Agent Creator 01
- Agent Limits Card 01
- Agent Progress 01
- AI Chat 01
- AI Image Generation 01
- AI Profile 01
- Alerts Card 01
- Auth Card 01
- Calendar 01
- Composer 01
- Composer Attachments 01
- Composer Panel 01
- Finance Dashboard 01
- Home Dashboard 01
- Marketing Dashboard 01
- Medical Profile 01
- Meeting Scheduler 01
- Multi Agent Chat 01
- Notification Center 01
- Patient Info Card 01
- Project Board 01
- Questionnaire 01
- Settings Modal 01
- Sidebar 01
- Stat Cards 01
- Task List 01
- Web Search 01
- Activity Rings Card 01
- Area Chart Card 01
- Bar List Card 01
- Combo Chart Card 01
- Contributions Card 01
- Earnings Chart Card 01
- Funnel Chart Card 01
- Heatmap Chart Card 01
- Line Chart Card 01
- Most Active Days Card 01
- Orders Chart Card 01
- Radar Chart Card 01
- Radial Chart Card 01
- Revenue Chart Card 01
- Sankey Chart Card 01
- Scatter Chart Card 01
- Sleep Score Card 01
- Stage Bars Card 01
- Steps Card 01
Installation
$ pnpm dlx shadcn@latest add @cobalt/sheet
Options
-
overlayClassNameonSheetContentstyles the backdrop, for examplebg-transparentorbg-background/60 backdrop-blur-xsfor a panel that keeps the page visible. -
size="flush"onSheetContentremoves the margin and the rounded corners, so the panel fills its edge and nothing of the page shows around it. Use it for a navigation panel on a phone. -
variant="ghost"onSheetContentdraws no border, fill or shadow, for aCardplaced inside. It keeps itssize.
Source
"use client";
import { Dialog as SheetPrimitive } from "@base-ui/react/dialog";
import { RiCloseLine } from "@remixicon/react";
import { cn } from "cn";
import * as React from "react";
import { Button } from "@/components/ui/button";
function Sheet({ ...props }: SheetPrimitive.Root.Props) {
return <SheetPrimitive.Root data-slot="sheet" {...props} />;
}
function SheetTrigger({ ...props }: SheetPrimitive.Trigger.Props) {
return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />;
}
function SheetClose({ ...props }: SheetPrimitive.Close.Props) {
return <SheetPrimitive.Close data-slot="sheet-close" {...props} />;
}
function SheetPortal({ ...props }: SheetPrimitive.Portal.Props) {
return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />;
}
function SheetOverlay({ className, ...props }: SheetPrimitive.Backdrop.Props) {
return (
<SheetPrimitive.Backdrop
data-slot="sheet-overlay"
className={cn(
"fixed inset-0 z-50 bg-[var(--drawer-backdrop,rgb(0_0_0/0.4))] transition-opacity duration-300 ease-out motion-reduce:transition-none data-ending-style:opacity-0 data-starting-style:opacity-0",
className
)}
{...props}
/>
);
}
function SheetContent({
className,
children,
side = "right",
showCloseButton = true,
size = "default",
overlayClassName,
variant = "default",
...props
}: SheetPrimitive.Popup.Props & {
/** `ghost` has no border, fill or shadow, for a Card placed inside. It keeps its `size`. */
variant?: "default" | "ghost";
side?: "top" | "right" | "bottom" | "left";
showCloseButton?: boolean;
/** `flush` fills the edge: no margin and no rounded corners, so nothing shows around the panel. */
size?: "default" | "flush";
/** Classes for the backdrop, e.g. `bg-transparent` for a panel that keeps the page visible. */
overlayClassName?: string;
}) {
return (
<SheetPortal>
<SheetOverlay className={overlayClassName} />
<SheetPrimitive.Popup
data-slot="sheet-content"
data-side={side}
data-size={size}
className={cn(
"fixed z-50 m-2 flex max-h-[calc(100dvh-16px)] flex-col gap-4 overflow-clip rounded-[24px] border border-[var(--surface-strong,var(--border))] bg-[var(--surface-overlay,var(--popover))] py-6 text-sm text-popover-foreground shadow-[shadow:var(--shadow-control,0_1px_2px_0_rgb(0_0_0/0.05))] outline-none transition-[translate,filter,opacity] duration-300 ease-[cubic-bezier(0.32,0.72,0,1)] motion-safe:data-ending-style:blur-[4px] motion-safe:data-starting-style:blur-[4px] motion-reduce:transition-none motion-reduce:data-ending-style:opacity-0 motion-reduce:data-starting-style:opacity-0 sm:m-3 sm:max-h-[calc(100dvh-24px)]",
"data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:max-h-[85%] motion-safe:data-[side=bottom]:data-ending-style:translate-y-[calc(100%+24px)] motion-safe:data-[side=bottom]:data-starting-style:translate-y-[calc(100%+24px)]",
"data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:max-h-[85%] motion-safe:data-[side=top]:data-ending-style:-translate-y-[calc(100%+24px)] motion-safe:data-[side=top]:data-starting-style:-translate-y-[calc(100%+24px)]",
"data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:w-[calc(100%-16px)] data-[side=left]:max-w-[400px] motion-safe:data-[side=left]:data-ending-style:-translate-x-[calc(100%+24px)] motion-safe:data-[side=left]:data-starting-style:-translate-x-[calc(100%+24px)]",
"data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:w-[calc(100%-16px)] data-[side=right]:max-w-[400px] motion-safe:data-[side=right]:data-ending-style:translate-x-[calc(100%+24px)] motion-safe:data-[side=right]:data-starting-style:translate-x-[calc(100%+24px)]",
size === "flush" &&
"m-0 max-h-dvh rounded-none border-0 sm:m-0 sm:max-h-dvh data-[side=left]:max-w-[320px] data-[side=left]:border-r data-[side=right]:max-w-[320px] data-[side=right]:border-l",
variant === "ghost" &&
"border-0 bg-transparent shadow-none data-[side=left]:border-r-0 data-[side=right]:border-l-0",
className
)}
{...props}
>
{children}
{showCloseButton && (
<SheetPrimitive.Close
data-slot="sheet-close"
render={
<Button
variant="close"
className="absolute top-6 right-5"
size="icon-xs"
/>
}
>
<RiCloseLine className="size-6" />
<span className="sr-only">Close</span>
</SheetPrimitive.Close>
)}
</SheetPrimitive.Popup>
</SheetPortal>
);
}
function SheetHeader({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="sheet-header"
className={cn("flex flex-col gap-1 px-6 pr-14", className)}
{...props}
/>
);
}
function SheetFooter({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="sheet-footer"
className={cn(
"mt-auto flex flex-col-reverse gap-2 px-6 sm:flex-row sm:items-center sm:justify-end",
className
)}
{...props}
/>
);
}
function SheetTitle({ className, ...props }: SheetPrimitive.Title.Props) {
return (
<SheetPrimitive.Title
data-slot="sheet-title"
className={cn(
"text-[18px] leading-[26px] font-medium text-foreground",
className
)}
{...props}
/>
);
}
function SheetDescription({
className,
...props
}: SheetPrimitive.Description.Props) {
return (
<SheetPrimitive.Description
data-slot="sheet-description"
className={cn(
"text-[14px] leading-[20px] text-balance text-muted-foreground",
className
)}
{...props}
/>
);
}
export {
Sheet,
SheetTrigger,
SheetClose,
SheetContent,
SheetHeader,
SheetFooter,
SheetTitle,
SheetDescription,
}; On this page