# Sheet

Extends the Dialog component to display content that complements the main content of the screen.

Section: Components / Overlays
Page: https://ui.heyramzi.com/components/sheet
Import path: `@heyramzi/ui/shadcn/sheet`

## Import

```ts
import * as Sheet from "@heyramzi/ui/shadcn/sheet";
import { Button } from "@heyramzi/ui/shadcn/button";
import { buttonVariants } from "@heyramzi/ui/shadcn/button";
import { Input } from "@heyramzi/ui/shadcn/input";
import { Label } from "@heyramzi/ui/shadcn/label";
```

## Usage

```svelte
<Sheet.Root>
  <Sheet.Trigger>Edit client</Sheet.Trigger>
  <Sheet.Content side="right">
    <Sheet.Header>
      <Sheet.Title>Edit client</Sheet.Title>
      <Sheet.Description>Shown on invoices and the portal.</Sheet.Description>
    </Sheet.Header>
    <Sheet.Body>
      <input aria-label="Name" value="Acme Corp" />
    </Sheet.Body>
    <Sheet.Footer band>
      <Sheet.Close>Cancel</Sheet.Close>
    </Sheet.Footer>
  </Sheet.Content>
</Sheet.Root>
```

## Demo

```svelte
<script lang="ts">
	import * as Sheet from "@heyramzi/ui/shadcn/sheet";
	import { Button } from "@heyramzi/ui/shadcn/button";
	import { buttonVariants } from "@heyramzi/ui/shadcn/button";
	import { Input } from "@heyramzi/ui/shadcn/input";
	import { Label } from "@heyramzi/ui/shadcn/label";
</script>

<div class="flex flex-wrap gap-2">
<Sheet.Root>
	<Sheet.Trigger class={buttonVariants({ variant: "outline" })}>Open from the right</Sheet.Trigger>
	<Sheet.Content side="right">
		<Sheet.Header>
			<Sheet.Title>Edit profile</Sheet.Title>
			<Sheet.Description>
				Make changes to your profile here. Click save when you're done.
			</Sheet.Description>
		</Sheet.Header>
		<div class="grid flex-1 auto-rows-min gap-6 px-4">
			<div class="grid gap-3">
				<Label for="name" class="text-end">Name</Label>
				<Input id="name" value="Pedro Duarte" />
			</div>
			<div class="grid gap-3">
				<Label for="username" class="text-end">Username</Label>
				<Input id="username" value="@peduarte" />
			</div>
		</div>
		<Sheet.Footer>
			<Button type="submit">Save changes</Button>
			<Sheet.Close class={buttonVariants({ variant: "outline" })}>Close</Sheet.Close>
		</Sheet.Footer>
	</Sheet.Content>
</Sheet.Root>
<Sheet.Root>
	<Sheet.Trigger class={buttonVariants({ variant: "outline" })}>Open from the bottom</Sheet.Trigger>
	<Sheet.Content side="bottom">
		<Sheet.Header>
			<Sheet.Title>Share this page</Sheet.Title>
			<Sheet.Description>Anyone with the link can view it.</Sheet.Description>
		</Sheet.Header>
		<Sheet.Footer>
			<Button type="submit">Copy link</Button>
			<Sheet.Close class={buttonVariants({ variant: "outline" })}>Close</Sheet.Close>
		</Sheet.Footer>
	</Sheet.Content>
</Sheet.Root>
</div>
```

## API

### Sheet.Root

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `open` | `boolean` | `false` | bindable |

Every prop of `Dialog.Root` from `bits-ui`.

### Sheet.Trigger

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `ref` | `HTMLElement \| null` | `null` | bindable |

Every prop of `Dialog.Trigger` from `bits-ui`.

### Sheet.Content

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `portalProps` | `WithoutChildrenOrChild<ComponentProps<typeof SheetPortal>>` |  |  |
| `side` | `"left"` \| `"right"` \| `"bottom"` | `"right"` |  |
| `showCloseButton` | `boolean` | `true` |  |
| `closeLabel` | `string` | `"Close"` | What a screen reader calls the built-in close button, in the app's language. |
| `floating` | `boolean` |  | From `sm` up a left or right sheet floats 8px off the edge, like SidePanel; `floating={false}` keeps it flush. A phone stays full bleed for the width. |
| `children` | `Snippet` |  | required |
| `ref` | `HTMLElement \| null` | `null` | bindable |
| `class` | `string` |  |  |

Every prop of `Dialog.Content` from `bits-ui`, except `child, children`.

### Sheet.Header

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `ref` | `HTMLDivElement \| null` | `null` | bindable |
| `class` | `string` |  |  |
| `children` | `Snippet` |  |  |

Every prop of `HTMLAttributes<HTMLDivElement>` from `svelte/elements`.

### Sheet.Title

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `ref` | `HTMLElement \| null` | `null` | bindable |
| `class` | `string` |  |  |

Every prop of `Dialog.Title` from `bits-ui`.

### Sheet.Description

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `ref` | `HTMLElement \| null` | `null` | bindable |
| `class` | `string` |  |  |

Every prop of `Dialog.Description` from `bits-ui`.

### Sheet.Footer

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `band` | `boolean` | `false` | A hairline on top and a quiet surface edge to edge, following the sheet's bottom corners when it floats. A bare `data-band` attribute does the same. |
| `ref` | `HTMLDivElement \| null` | `null` | bindable |
| `class` | `string` |  |  |
| `children` | `Snippet` |  |  |

Every prop of `HTMLAttributes<HTMLDivElement>` from `svelte/elements`.

### Sheet.Close

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `ref` | `HTMLElement \| null` | `null` | bindable |

Every prop of `Dialog.Close` from `bits-ui`.

### Sheet.Portal

Every prop of `Dialog.Portal` from `bits-ui`.

### Sheet.Overlay

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `ref` | `HTMLElement \| null` | `null` | bindable |
| `class` | `string` |  |  |

Every prop of `Dialog.Overlay` from `bits-ui`.

### Sheet.Body

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `ref` | `HTMLDivElement \| null` | `null` | bindable |
| `class` | `string` |  |  |
| `children` | `Snippet` |  |  |

Every prop of `HTMLAttributes<HTMLDivElement>` from `svelte/elements`.
