> A component of a Premium AI Canvas design system. Index of every system, component and install setup: https://aicanvas.me/llms.txt

# Popover (Andromeda Pro)

Floats a panel of mixed content off a trigger, such as a picker with a setting under it.

- Design system: [Andromeda Pro](https://aicanvas.me/design-systems/andromeda-pro.md)
- License: Premium (proprietary)
- Install slug: `andromeda-pro-popover`
- Page: https://aicanvas.me/design-systems/andromeda-pro/popover

## Install

```bash
npx shadcn@latest add @aicanvas/andromeda-pro-popover
```

Requires Premium. Without a Premium token the command writes a placeholder instead of the component.

Every Andromeda Pro component at once: `npx shadcn@latest add @aicanvas/andromeda-pro`.

Token setup: the Install section of https://aicanvas.me/llms.txt.

## Props

### Popover

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `open?` | `boolean` |  | Controlled open state. Pair with `onOpenChange`. Leave unset for an uncontrolled popover. |
| `defaultOpen?` | `boolean` | `false` | Initial open state of an uncontrolled popover. |
| `onOpenChange?` | `(open: boolean) => void` |  | Called with the next open state on every request: the trigger's toggle, an outside pointer-down, Escape. |
| `children?` | `React.ReactNode` |  | The anchor (a `PopoverTrigger`, or a field its owner opens and closes) and the `PopoverContent`. |
| `className?` | `string` |  | Extra class on the anchor wrapper. |
| `style?` | `React.CSSProperties` |  | Inline styles merged onto the anchor wrapper, e.g. a width for a field anchor. |

### PopoverTrigger

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `asChild?` | `boolean` | `false` | Renders via Radix Slot, merging the trigger's props onto its only child (a Button, an IconButton, a custom button) instead of a bare native button. |
| `render?` | `React.ReactElement` |  | The same as asChild, in the Base UI form some installers rewrite asChild into: the trigger renders this element with its props merged onto it, and the trigger's children, when given, become the element's children. |
| `aria-haspopup?` | `'dialog'\|'menu'\|'listbox'\|'grid'\|'tree'\|boolean` | `'dialog'` | What the panel is. Match it to `PopoverContent`'s `role`. |
| `type?` | `'button'\|'submit'\|'reset'` | `'button'` | HTML button type, omitted when asChild or render is set. |
| `onClick?` | `(event: React.MouseEvent<HTMLButtonElement>) => void` |  | Runs before the toggle; call `event.preventDefault()` to keep the popover as it is. |
| `children?` | `React.ReactNode` |  | The trigger's content, with asChild the element that becomes the trigger, with render the element's content. |
| `className?` | `string` |  | Additional CSS classes applied to the root element. |
| `style?` | `React.CSSProperties` |  | Merged over the open-state fill, so a trigger that paints its own open state keeps it. |

### PopoverContent

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `side?` | `'auto'\|'top'\|'bottom'` | `'auto'` | Which side of the anchor the panel opens on. `auto` takes the side with room for the whole panel inside the nearest scrolling ancestor (above first), else the roomier side with the panel capped to it and scrolling. `top` / `bottom` pin the side and cap the panel to that side's room. |
| `align?` | `'start'\|'end'` | `'start'` | Which edge of the anchor the panel lines up with. |
| `width?` | `string\|number` |  | Panel width, any CSS length. `'100%'` matches the anchor. Unset, the panel sizes to its content. Always capped inside the viewport. |
| `role?` | `string` | `'dialog'` | The panel's role: `dialog` for mixed content, `menu` for a menu, `listbox` for a results list. |
| `aria-label?` | `string` |  | Accessible name. Unset, the panel is named by its `PopoverLabel` when it has one. |
| `id?` | `string` |  | Panel id; the trigger's `aria-controls` follows it. Generated when unset. |
| `children?` | `React.ReactNode` |  | The panel's content: rows, a label, separators, controls. |
| `className?` | `string` |  | Extra class on the panel. |
| `style?` | `React.CSSProperties` |  | Inline styles merged onto the panel. |

### PopoverLabel

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children?` | `React.ReactNode` |  | The section's name, sentence case; the role sets it in capitals. |
| `id?` | `string` |  | Label id. Generated when unset; the panel is named by it unless it has an aria-label. |
| `className?` | `string` |  | Additional CSS classes applied to the root element. |
| `style?` | `React.CSSProperties` |  | Inline styles applied to the root element. |

### PopoverSeparator

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className?` | `string` |  | Additional CSS classes applied to the root element. |
| `style?` | `React.CSSProperties` |  | Inline styles applied to the root element. |

## Remix prompt

The public part of this component's remix prompt. The rest of the build spec is part of Premium.

```markdown
Build **Popover**: a floating panel anchored to a trigger or a field, holding any content: a choice list with a setting under it, a list of switches, a search field's results. React + TypeScript, one file, named exports `Popover`, `PopoverTrigger`, `PopoverContent`, `PopoverLabel`, `PopoverSeparator`, plus a props type for each (`PopoverProps`, `PopoverTriggerProps`, `PopoverContentProps`, `PopoverLabelProps`, `PopoverSeparatorProps`). Use framer-motion for the panel's entrance and `@radix-ui/react-slot` for `asChild`.

It is drawn to sit on a near-black ground, `oklch(0.135 0.002 286.2)`. The anchor wrapper paints nothing; the panel paints its own solid floating ground. Typeface: Manrope, falling back to the system sans.

A popover is a light surface, not a task. It has no focus trap and moves no focus on open. The panel carries no row styles either: rows belong to the content you put in it.
```

## More Andromeda Pro components

- [Pricing Card](https://aicanvas.me/design-systems/andromeda-pro/pricing-card.md)
- [Progress Bar](https://aicanvas.me/design-systems/andromeda-pro/progress-bar.md)
- [Prompt Input](https://aicanvas.me/design-systems/andromeda-pro/prompt-input.md)
- [Radio](https://aicanvas.me/design-systems/andromeda-pro/radio.md)
- [Search Field](https://aicanvas.me/design-systems/andromeda-pro/search-field.md)
