Side Sheet
A modal panel that slides in from any screen edge, built on the Radix Dialog primitive.
Preview
Recent orders
$18,940.75 this week
3 of 148
Install
Add the editable source with the shadcn CLI. Your project also needs the shared theme tokens this component uses. Setup and requirements. The Pebble installer is not published yet.
npx shadcn@latest add https://pebbleui.com/r/side-sheet.jsonProps
| Prop | Type | Default | Description |
|---|---|---|---|
| open | boolean | — | Controlled open state (root). |
| defaultOpen | boolean | false | Uncontrolled initial state (root). |
| onOpenChange | (open: boolean) => void | — | Called when the open state changes (root). |
| side | "top" | "right" | "bottom" | "left" | "right" | Screen edge the panel attaches to (SideSheetContent). |
| showCloseButton | boolean | true | Render the corner close button (SideSheetContent). |
Build notes
A styled Radix `Dialog`; only the content positioning differs. Each side maps to a position class set (`inset-y-0 right-0 h-full ...`) plus a border on the inner edge and its own `animate-[side-sheet-in-<side>]` / `animate-[side-sheet-out-<side>]` utilities under `motion-safe:` and `data-state`. Keyframes in the registry item `css` field translate the panel fully off its edge (`translateX(100%)`, `translateX(-100%)`, `translateY(-100%)`, `translateY(100%)`) to `none`: 300 ms ease-out in, 200 ms ease-in out, so the exit is quicker than the entrance. The scrim fades over 200 ms (`side-sheet-fade-in/out`) and is `bg-black/50` so it dims in both themes. Surface is `card`; forced colors add a `CanvasText` border. The panel also carries `data-side` for styling hooks. **Pebble (2026-11-03).** The panel no longer sits flush against the edge with an inner border. It floats 8 px in (`inset-y-2 right-2` and so on) as a Pebble raised object: `rounded-2xl`, `ring-1 ring-hairline`, `shadow-raised-lg`, `inset-shadow-highlight`. The slide still translates 100% of the panel, and because the 8 px gap could show as a sliver, the entry pairs the slide (`--motion-slow`, `--motion-enter`) with `side-sheet-fade-in` (`--motion-base`) as a second comma-separated animation. Exits run `--motion-base` on `--motion-exit`. Reduced motion now fades the panel with the existing fade keyframes rather than popping it in; no new keyframes ship. The scrim is the `--scrim` token (`bg-scrim`: black at 40%, 60% dark) with a 2 px blur. The bottom sheet draws a 36 px grab handle with a `before:` pseudo-element. The footer is `sticky bottom-0` with a top rule on `bg-card`, so actions stay reachable in a long sheet. The demo is a recent-orders card where every real trigger opens a sheet: order rows open a right-side detail sheet (one `SideSheet` per row so focus returns to that row), Filter opens a left sheet, the notice bell a top sheet and Export a bottom sheet with a format radio group. <!-- PEBBLE-LICENSE -->
View source
registry/overlay/side-sheet/side-sheet.tsx
"use client";
/* PEBBLE-LICENSE
Built by Pebble. Component: side-sheet.
First-party license: MIT
The following first-party terms apply only to original Pebble material.
MIT License
Copyright (c) 2026 Praxys Solutions LLC (Pebble)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
THIRD-PARTY NOTICES
These notices apply to identified upstream portions; Pebble terms do not replace or narrow their rights.
Upstream: https://raw.githubusercontent.com/shadcn-ui/ui/main/LICENSE.md
MIT License
Copyright (c) 2023 shadcn
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
END PEBBLE-LICENSE */
import * as React from "react";
import { Dialog as SheetPrimitive } from "radix-ui";
import { cn } from "@/lib/utils";
export function SideSheet(props: React.ComponentProps<typeof SheetPrimitive.Root>) {
return <SheetPrimitive.Root data-slot="side-sheet" {...props} />;
}
export function SideSheetTrigger(props: React.ComponentProps<typeof SheetPrimitive.Trigger>) {
return <SheetPrimitive.Trigger data-slot="side-sheet-trigger" {...props} />;
}
export function SideSheetClose(props: React.ComponentProps<typeof SheetPrimitive.Close>) {
return <SheetPrimitive.Close data-slot="side-sheet-close" {...props} />;
}
export function SideSheetPortal(props: React.ComponentProps<typeof SheetPrimitive.Portal>) {
return <SheetPrimitive.Portal data-slot="side-sheet-portal" {...props} />;
}
export function SideSheetOverlay({
className,
...props
}: React.ComponentProps<typeof SheetPrimitive.Overlay>) {
return (
<SheetPrimitive.Overlay
data-slot="side-sheet-overlay"
className={cn(
// Black scrim: a foreground tint would lighten the page in dark mode.
"fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]",
// Opacity only, so it also runs under reduced motion.
"data-[state=open]:animate-[side-sheet-fade-in_var(--motion-slow)_var(--motion-enter)]",
"data-[state=closed]:animate-[side-sheet-fade-out_var(--motion-base)_var(--motion-exit)]",
className,
)}
{...props}
/>
);
}
// The panel floats 8 px off its edge as a Pebble object (radius, ring, deep
// shadow) instead of a flat slab glued to the viewport. It slides in on the
// slow enter curve while fading, so the 8 px gap never shows as a sliver.
const sides = {
right: cn(
"inset-y-2 right-2 w-3/4 sm:max-w-sm",
"motion-safe:data-[state=open]:animate-[side-sheet-in-right_var(--motion-slow)_var(--motion-enter),side-sheet-fade-in_var(--motion-base)_var(--motion-enter)]",
"motion-safe:data-[state=closed]:animate-[side-sheet-out-right_var(--motion-base)_var(--motion-exit)]",
),
left: cn(
"inset-y-2 left-2 w-3/4 sm:max-w-sm",
"motion-safe:data-[state=open]:animate-[side-sheet-in-left_var(--motion-slow)_var(--motion-enter),side-sheet-fade-in_var(--motion-base)_var(--motion-enter)]",
"motion-safe:data-[state=closed]:animate-[side-sheet-out-left_var(--motion-base)_var(--motion-exit)]",
),
top: cn(
"inset-x-2 top-2 max-h-[85vh]",
"motion-safe:data-[state=open]:animate-[side-sheet-in-top_var(--motion-slow)_var(--motion-enter),side-sheet-fade-in_var(--motion-base)_var(--motion-enter)]",
"motion-safe:data-[state=closed]:animate-[side-sheet-out-top_var(--motion-base)_var(--motion-exit)]",
),
bottom: cn(
"inset-x-2 bottom-2 max-h-[85vh] pt-3",
// A grab handle: the bottom sheet's familiar affordance, drawn not imaged.
"before:absolute before:top-2 before:left-1/2 before:h-1 before:w-9 before:-translate-x-1/2 before:rounded-full before:bg-border",
"motion-safe:data-[state=open]:animate-[side-sheet-in-bottom_var(--motion-slow)_var(--motion-enter),side-sheet-fade-in_var(--motion-base)_var(--motion-enter)]",
"motion-safe:data-[state=closed]:animate-[side-sheet-out-bottom_var(--motion-base)_var(--motion-exit)]",
),
} as const;
export type SideSheetContentProps = React.ComponentProps<typeof SheetPrimitive.Content> & {
/** Screen edge the panel is attached to. */
side?: keyof typeof sides;
/** Render the corner close button. */
showCloseButton?: boolean;
};
export function SideSheetContent({
className,
children,
side = "right",
showCloseButton = true,
...props
}: SideSheetContentProps) {
return (
<SideSheetPortal>
<SideSheetOverlay />
<SheetPrimitive.Content
data-slot="side-sheet-content"
data-side={side}
className={cn(
"fixed z-50 flex flex-col gap-4 overflow-y-auto outline-none",
"rounded-2xl bg-card text-card-foreground shadow-raised-lg ring-1 inset-shadow-highlight ring-hairline",
"forced-colors:border forced-colors:border-[CanvasText]",
// Reduced motion keeps the fade and drops the slide.
"motion-reduce:data-[state=open]:animate-[side-sheet-fade-in_var(--motion-base)_linear]",
"motion-reduce:data-[state=closed]:animate-[side-sheet-fade-out_var(--motion-fast)_linear]",
sides[side],
className,
)}
{...props}
>
{children}
{showCloseButton && (
<SheetPrimitive.Close
data-slot="side-sheet-close-button"
className={cn(
"absolute top-4 right-4 inline-flex size-8 cursor-pointer items-center justify-center rounded-md text-muted-foreground",
"transition-[background-color,color,transform] duration-(--motion-fast) ease-enter motion-reduce:transition-none",
"hover:bg-muted hover:text-foreground active:scale-[0.94] motion-reduce:active:scale-100",
"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-card focus-visible:outline-none",
)}
>
<svg
viewBox="0 0 16 16"
fill="none"
stroke="currentColor"
strokeWidth="1.5"
strokeLinecap="round"
aria-hidden="true"
className="size-4"
>
<path d="M4 4l8 8M12 4l-8 8" />
</svg>
<span className="sr-only">Close</span>
</SheetPrimitive.Close>
)}
</SheetPrimitive.Content>
</SideSheetPortal>
);
}
export function SideSheetHeader({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="side-sheet-header"
className={cn("flex flex-col gap-1 p-5 pr-14 pb-0", className)}
{...props}
/>
);
}
export function SideSheetFooter({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="side-sheet-footer"
className={cn(
// Pinned to the bottom of the panel, divided from the body by a rule.
"sticky bottom-0 mt-auto flex flex-col-reverse gap-2 border-t border-border bg-card p-4 sm:flex-row sm:justify-end",
className,
)}
{...props}
/>
);
}
export function SideSheetTitle({
className,
...props
}: React.ComponentProps<typeof SheetPrimitive.Title>) {
return (
<SheetPrimitive.Title
data-slot="side-sheet-title"
className={cn("text-base leading-snug font-semibold tracking-[-0.01em]", className)}
{...props}
/>
);
}
export function SideSheetDescription({
className,
...props
}: React.ComponentProps<typeof SheetPrimitive.Description>) {
return (
<SheetPrimitive.Description
data-slot="side-sheet-description"
className={cn("text-sm text-pretty text-muted-foreground", className)}
{...props}
/>
);
}
