# Popover

> An anchored panel that opens next to a trigger and holds interactive content — quick settings, a small form, more than a tooltip can carry.

- Package: `fancy-ui-vue` (Vue 3.5+ + Tailwind CSS v4)
- Category: Overlays
- Tags: overlay, popover, anchored, disclosure, accessibility
- Types: `PopoverProps`, `PopoverContentProps`, `PopoverContext`
- Docs: https://fancy-ui.rama.app/docs/components/popover
- Source: https://github.com/RamaHerbin/fancy-ui/tree/main/vue/src/components/popover

## Import

```vue
<script setup lang="ts">
import { Popover } from 'fancy-ui-vue';
</script>
```

Setup (once per project): `npm install fancy-ui-vue`, then put these lines in your main CSS file (the stylesheet imports go right after `@import "tailwindcss";`):

```css
@import "tailwindcss";
@import "fancy-ui-vue/tailwind.css";
@import "fancy-ui-vue/styles.css";
```

Full guide: https://fancy-ui.rama.app/llms.txt

The names below are the ones to write in a Vue template; when one differs from the Svelte name, the Svelte name follows in parentheses. Snippets become named slots (`#default` is the default snippet), a prop the Vue port declares as a model is a `v-model:<name>` (except `ref`, exposed via `defineExpose({ ref })`: put a template ref on the component and read `.ref`) and callbacks are listeners (`onclick` is `@click`). Every component sets `inheritAttrs: false`: `class` is a declared prop, merged where the Svelte component applies it (not always the root element), and only when the props table below lists it; other attributes do not fall through unless the package README lists the component as forwarding native attributes. Divergences: https://github.com/RamaHerbin/fancy-ui/tree/main/vue#divergences-from-the-svelte-api

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `v-model:open` (Svelte `open`) | `boolean` | `false` | Whether the panel is open. Bindable |
| `@open-change` (Svelte `onOpenChange`) | `(open: boolean) => void` | — | Called with the new value whenever the panel opens or closes, however the change happened |
| `side` | `"top" \| "bottom" \| "left" \| "right"` | `"bottom"` | Side of the trigger to place the panel on. Flips when it would overflow |
| `align` | `"start" \| "center" \| "end"` | `"center"` | Alignment along the trigger's cross axis |
| `offset` | `number` | `8` | Gap in pixels between the trigger and the panel |
| `dismissible` | `boolean` | `true` | Whether Escape and an outside click close the panel |
| `class` | `string` | — | Additional CSS classes, merged onto the panel |
| `ref` | `HTMLDivElement \| null` | `null` | Bindable reference to the panel element |
| `sound` | `boolean` | `false` | Plays open when the trigger opens the panel and close on a dismissal, once the user has enabled sound |

## Slots

| Slot | Description |
| --- | --- |
| `#trigger` (Svelte `trigger`) | The trigger's content, rendered inside the real <button> this component owns and wires up |
| `#default` (Svelte `children`) | The panel's content |

## Example

```vue
<script setup lang="ts">
import { ref } from "vue";
import { Popover } from "fancy-ui-vue";

const width = ref("100%");
const height = ref("25px");
</script>

<template>
	<Popover sound class="w-[220px]">
		<template #trigger>⚙ Options</template>

		<span class="text-[13px] font-semibold">Dimensions</span>
		<div class="flex gap-2">
			<input
				v-model="width"
				aria-label="Width"
				class="border-input bg-background text-foreground min-w-0 flex-1 rounded-[6px] border px-2 py-[5px] text-[12px]"
			/>
			<input
				v-model="height"
				aria-label="Height"
				class="border-input bg-background text-foreground min-w-0 flex-1 rounded-[6px] border px-2 py-[5px] text-[12px]"
			/>
		</div>
	</Popover>
</template>
```
