--- title: "sheet" description: "Panel that slides in from an edge of the screen." category: "Overlays" --- # sheet Panel that slides in from an edge of the screen. ## Installation ```bash php artisan ui:add sheet ``` ## Dependencies - composer: `gehrisandro/tailwind-merge-laravel` ## Usage ```blade Open
Body content…
Save changes
``` ## Example The demo rendered on the docs page. ```blade Open
Name
Username
Save changes
``` ## Source Copy this file to the path shown above it. `resources/views/components/ui/sheet.blade.php` ```blade @props([ 'side' => 'right', 'title' => null, 'description' => null, ]) @php // Same approach as the dialog component: a native dialog element in // the top layer, so a // sheet triggered from inside a sticky, backdrop-blurred header still // covers the viewport instead of being trapped by that ancestor. $id = 'ui-sheet-' . bin2hex(random_bytes(4)); // shadcn SheetContent per-side positioning, size and border. $sideClasses = match ($side) { 'top' => 'inset-x-0 top-0 h-auto border-b', 'bottom' => 'inset-x-0 bottom-0 h-auto border-t', 'left' => 'inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm', default => 'inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm', }; // Where the panel sits while closed; it slides to 0 when open. $offscreen = match ($side) { 'top' => '-translate-y-full group-data-[state=open]/sheet:translate-y-0', 'bottom' => 'translate-y-full group-data-[state=open]/sheet:translate-y-0', 'left' => '-translate-x-full group-data-[state=open]/sheet:translate-x-0', default => 'translate-x-full group-data-[state=open]/sheet:translate-x-0', }; // Not bg-black/50. Tailwind v4 compiles that to oklab(0 0 0 / 0.5), and // Chrome does not paint a modern colour function with alpha inside the // dialog top layer, so the scrim silently renders as nothing. A legacy // rgb() with alpha composites correctly in the same place. $overlay = 'absolute inset-0 bg-[rgb(0_0_0/0.5)] opacity-0 transition-opacity duration-300 group-data-[state=open]/sheet:opacity-100'; $panel = \TailwindMerge\Laravel\Facades\TailwindMerge::merge( 'absolute flex flex-col gap-4 bg-background shadow-lg transition-transform duration-300 ease-in-out', $sideClasses, $offscreen, $attributes->get('class'), ); @endphp
except('class') }}> {{ $trigger }}
@if ($title || $description)
@if ($title)

{{ $title }}

@endif @if ($description)

{{ $description }}

@endif
@endif {{ $slot }} @isset($footer)
{{ $footer }}
@endisset
@once @endonce ``` ## Theme tokens `--background`, `--border`, `--muted-foreground`, `--ring` Built on the native element (top layer, focus trap, Esc to close) plus a small inline