# Popover

Displays rich content in a portal, triggered by a button.

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

## Import

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

## Usage

```svelte
<Popover.Root>
  <Popover.Trigger>Open popover</Popover.Trigger>
  <Popover.Content>Set the dimensions for the layer.</Popover.Content>
</Popover.Root>
```

## Demo

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

<Popover.Root>
	<Popover.Trigger class={buttonVariants({ variant: "outline" })}>Open popover</Popover.Trigger>
	<Popover.Content class="w-80">
		<div class="grid gap-4">
			<div class="space-y-2">
				<h4 class="leading-none font-medium">Dimensions</h4>
				<p class="text-sm text-muted-foreground">Set the dimensions for the layer.</p>
			</div>
			<div class="grid gap-2">
				<div class="grid grid-cols-3 items-center gap-4">
					<Label for="width">Width</Label>
					<Input id="width" value="100%" class="col-span-2 h-8" />
				</div>
				<div class="grid grid-cols-3 items-center gap-4">
					<Label for="maxWidth">Max. width</Label>
					<Input id="maxWidth" value="300px" class="col-span-2 h-8" />
				</div>
				<div class="grid grid-cols-3 items-center gap-4">
					<Label for="height">Height</Label>
					<Input id="height" value="25px" class="col-span-2 h-8" />
				</div>
				<div class="grid grid-cols-3 items-center gap-4">
					<Label for="maxHeight">Max. height</Label>
					<Input id="maxHeight" value="none" class="col-span-2 h-8" />
				</div>
			</div>
		</div>
	</Popover.Content>
</Popover.Root>
```

## API

### Popover.Root

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

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

### Popover.Trigger

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

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

### Popover.Content

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `portalProps` | `WithoutChildrenOrChild<ComponentProps<typeof PopoverPortal>>` |  |  |
| `ref` | `HTMLElement \| null` | `null` | bindable |
| `class` | `string` |  |  |
| `sideOffset` | `number` | `4` |  |
| `align` | `string` | `"center"` |  |
| `collisionPadding` | `number` | `8` |  |

Every prop of `Popover.Content` from `bits-ui`.

### Popover.Description

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

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

### Popover.Header

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

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

### Popover.Title

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

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

### Popover.Close

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

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

### Popover.Portal

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