Skip to content

Popover

A small panel that opens next to the button that called it, for a couple of fields or a few details, without covering the page.

import { Popover } from '@sypnia/ui/react'

On this page
  1. A small form
  2. Details of a person
  3. Placement
  4. When to use it
  5. For everyone
  6. Props

A small form

Choose a status: the list behind would update while it stays open.

Showing every order.
Code
import { useState } from 'react';
import { Button, Field, NativeSelect, Popover } from '@sypnia/ui/react';

// It opens anchored to its button. Escape or a press outside closes it and the focus returns.
export default function SmallForm() {
  const [status, setStatus] = useState('any');
  return (
    <div className="sy-row">
      <Popover label="Filter orders" trigger={<Button icon="filter">Filter</Button>}>
        <Field label="Status">
          <NativeSelect value={status} onChange={(e) => setStatus(e.target.value)}>
            <option value="any">Any status</option><option value="paid">Paid</option><option value="pending">Pending</option><option value="refunded">Refunded</option>
          </NativeSelect>
        </Field>
        <Button size="sm" variant="quiet" onClick={() => setStatus('any')}>Clear the filter</Button>
      </Popover>
      <span className="sy-text--sm sy-text--soft">{status === 'any' ? 'Showing every order.' : `Showing ${status} orders.`}</span>
    </div>
  );
}

Details of a person

Press the name.

Code
import { Button, Identity, KeyValue, Popover } from '@sypnia/ui/react';

// More about a thing without leaving the page.
export default function Details() {
  return (
    <Popover label="About Laura Méndez" trigger={<Button variant="quiet">Laura Méndez</Button>}>
      <Identity name="Laura Méndez" meta="laura@northwind.io" />
      <KeyValue items={[['Role', 'Owner'], ['Joined', 'November 3, 2026'], ['Last seen', 'Today']]} />
    </Popover>
  );
}

Placement

Below from the start, below from the end, and above.

Code
import { Button, Popover } from '@sypnia/ui/react';

// It opens where you ask and flips by itself when there is no room.
export default function Placement() {
  return (
    <div className="sy-row sy-row--pairs">
      <Popover placement="bottom start" label="Below, from the start" trigger={<Button>Below, start</Button>}><p>Aligned with the start of the button.</p></Popover>
      <Popover placement="bottom end" label="Below, from the end" trigger={<Button>Below, end</Button>}><p>Aligned with the end of the button.</p></Popover>
      <Popover placement="top" label="Above" trigger={<Button>Above</Button>}><p>Centred above the button.</p></Popover>
    </div>
  );
}

When to use it

Use it when

  • A filter, a small setting, the details of a person or a thing.
  • The content is short and relates to the thing it is anchored to.

Do not use it when

  • It is a list of actions: that is a Menu, which has its own keys.
  • It is one line of text about a button: Tooltip.
  • It needs a decision before the person continues, or has many fields: Dialog or Drawer.

For everyone

  • It opens on press, never on hover. The button says whether it is open (aria-expanded).
  • It is a dialog with a name (label). Focus moves inside, Escape or a press outside closes it and focus returns to the button.
  • It is drawn in the top layer and flips or shifts to stay inside the window, also on phones.

Props

PopoverTypeDefault
labelrequired string
triggerrequired ReactElement<any, string | JSXElementConstructor<any>>
placement "bottom start" | "bottom end" | "top start" | "top end" | "bottom" | "top" bottom start
  1. A small form
  2. Details of a person
  3. Placement
  4. When to use it
  5. For everyone
  6. Props

    Search pages, sections and terms