# Popover

Non-modal content anchored to a trigger: extra detail, a small form, a picker.

- Family: overlay
- Import: `import { Popover } from "@senvenli/react/overlay";`
- Page: https://design.senvenli.com/docs/components/popover
- JSON: https://design.senvenli.com/docs/components/popover.json

## Example: A small form under a button

The title names the panel; a press outside or Esc closes it.

```tsx
import { Button } from "@senvenli/react/action";
import { Popover } from "@senvenli/react/overlay";
import { Checkbox, CheckboxGroup } from "@senvenli/react/selection";

export default function Example() {
  return (
    <Popover title="Filters" trigger={<Button iconBefore="list-filter">Filters</Button>}>
      <CheckboxGroup label="Status" defaultValue={["open"]}>
        <Checkbox value="open">Open</Checkbox>
        <Checkbox value="paid">Paid</Checkbox>
        <Checkbox value="overdue">Overdue</Checkbox>
      </CheckboxGroup>
    </Popover>
  );
}
```

## Examples

### Closed by its own action

Controlled open state, so Apply can close the panel.

```tsx
import { Button } from "@senvenli/react/action";
import { Input } from "@senvenli/react/form";
import { Stack } from "@senvenli/react/layout";
import { Popover } from "@senvenli/react/overlay";
import { useState } from "react";

export default function Example() {
  const [isOpen, setIsOpen] = useState(false);
  const [limit, setLimit] = useState(500);
  const [draft, setDraft] = useState(limit);
  return (
    <Popover
      title="Spending limit"
      isOpen={isOpen}
      onOpenChange={(next) => {
        setIsOpen(next);
        if (next) setDraft(limit);
      }}
      trigger={<Button>Limit: ${limit}</Button>}
    >
      <Stack space="space-200">
        <Input type="number" label="Monthly limit" minValue={0} step={50} value={draft} onChange={setDraft} formatOptions={{ style: "currency", currency: "USD", maximumFractionDigits: 0 }} />
        <Button
          variant="primary"
          onPress={() => {
            setLimit(draft);
            setIsOpen(false);
          }}
        >
          Apply
        </Button>
      </Stack>
    </Popover>
  );
}
```

### Extra detail, placed above

No title: an aria-label names the panel instead.

```tsx
import { Button } from "@senvenli/react/action";
import { DescriptionList } from "@senvenli/react/display";
import { Popover } from "@senvenli/react/overlay";

export default function Example() {
  return (
    <Popover aria-label="Payment details" placement="top" trigger={<Button variant="link">Paid by card ending 4242</Button>}>
      <DescriptionList
        layout="stacked"
        items={[
          { label: "Paid on", value: "March 18, 2026" },
          { label: "Amount", value: "$248.00" },
          { label: "Reference", value: "PAY-88213", copyValue: "PAY-88213" },
        ]}
      />
    </Popover>
  );
}
```

## Guidelines

### When to use it

- Showing a little interactive content next to what opened it.

### Use something else when

- [tooltip](https://design.senvenli.com/docs/components/tooltip.md): It is only a short hint.
- [hover-card](https://design.senvenli.com/docs/components/hover-card.md): A preview of a link or person that opens on hover, with no click.

## Accessibility

Keyboard:

- Esc: Closes and returns focus to the trigger.

Built in:

- Positioned to stay on screen, also in RTL.

You provide:

- A trigger with a clear name.

## API reference

### Popover

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| trigger | `ReactElement<unknown, string \| JSXElementConstructor<any>>` |  | yes | The pressable that opens it (a DS Button: "Filtre"). |
| children | `React.ReactNode` |  | yes |  |
| placement | `Placement` |  | no | "bottom start" by default; React Aria flips it when there is no room. |
| isOpen | `boolean` |  | no |  |
| defaultOpen | `boolean` |  | no |  |
| onOpenChange | `(isOpen: boolean) => void` |  | no |  |
| title | `React.ReactNode` |  | no | A heading that also names the panel ("Filters"); without it, give `aria-label`. |
| aria-label | `string` |  | no |  |
| motion | `ComponentMotion` |  | no | `auto` (follow the device), `reduce` or `none`, for this component; the provider's setting otherwise. |

### Tokens it reads

`--ds-background-neutral-bold`, `--ds-background-neutral-pressed`, `--ds-background-neutral-subtle-hovered`, `--ds-blanket`, `--ds-border`, `--ds-border-focused`, `--ds-easing-enter`, `--ds-easing-exit`, `--ds-icon-danger`, `--ds-icon-subtle`, `--ds-radius-large`, `--ds-radius-small`, `--ds-radius-xlarge`, `--ds-shadow-overlay`, `--ds-space-050`, `--ds-space-075`, `--ds-space-100`, `--ds-space-150`, `--ds-space-200`, `--ds-space-300`, `--ds-surface-overlay`, `--ds-text`, `--ds-text-danger`, `--ds-text-disabled`, `--ds-text-inverse`, `--ds-text-subtle`, `--ds-text-subtlest`, `--font-ds-mono`

## Related

- [tooltip](https://design.senvenli.com/docs/components/tooltip.md)
- [menu](https://design.senvenli.com/docs/components/menu.md)
