Quire UI
Overlays6

Popover

A floating panel from its trigger, with an optional arrow, sizes and a small form.

Installation

npx shadcn@latest add @quireui/popover

Usage

<Popover>
  <PopoverTrigger render={<Button />}>Notifications</PopoverTrigger>
  <PopoverContent>
    <PopoverTitle>All caught up</PopoverTitle>
    <PopoverDescription>New mentions will show up here.</PopoverDescription>
  </PopoverContent>
</Popover>

Arrow

Pass arrow to point at the trigger. Use it when several triggers sit close together, like info icons in a table or toolbar, so it is clear which one the popover belongs to.

Overdue$4,280.00

Sizes

size on PopoverContent: sm (14rem), md (18rem, default), lg (24rem) or auto to fit the content. On small screens it never gets wider than the viewport.

Form

For a quick edit that does not deserve a dialog. PopoverForm validates like Input, focus starts on the first field, and Cmd/Ctrl+Enter submits from any field, a textarea included.

<Popover open={open} onOpenChange={setOpen}>
  <PopoverTrigger render={<Button />}>Add note</PopoverTrigger>
  <PopoverContent>
    <PopoverForm onFormSubmit={(values) => { save(values.note); setOpen(false); }}>
      <Field name="note">
        <FieldLabel>Note</FieldLabel>
        <Textarea required />
        <FieldError />
      </Field>
      <PopoverFooter>
        <PopoverClose render={<Button variant="ghost" size="sm" />}>Cancel</PopoverClose>
        <Button type="submit" variant="primary" size="sm" shortcut="mod+enter">Save</Button>
      </PopoverFooter>
    </PopoverForm>
  </PopoverContent>
</Popover>

Scrolling

The popover follows its trigger while the page scrolls. When the trigger leaves the view, the popover hides with it instead of floating over unrelated content, and comes back with anything you typed once the trigger is visible again.

Accessibility

The trigger says whether the popover is open. Focus moves into the popover when it opens and back to the trigger when it closes.

KeyAction
Enter / SpaceOn the trigger: opens or closes the popover.
EscCloses the popover and returns focus to the trigger.
TabMoves through the popover's content.
Cmd/Ctrl+EnterSubmits a PopoverForm from any field, a textarea included.

Popover or something else?

  • Content shown on hover that only previews a link: Hover card.
  • A short label for an icon button: Tooltip.
  • A list of actions: Dropdown menu.
  • Longer forms, or anything that needs your full attention: Dialog.

API reference

PopoverTrigger

Also takes every prop of Base UI's Popover.Trigger.

PopoverClose

Also takes every prop of Base UI's Popover.Close.

PopoverContent

Prop

Type

Also takes every prop of Base UI's Popover.Popup. Style it with [data-slot="popover"].

Popover

Also takes every prop of Base UI's Popover.Root.

PopoverTitle

Also takes every prop of Base UI's Popover.Title.

PopoverDescription

Also takes every prop of Base UI's Popover.Description.

PopoverForm

A small form: validates like Input, Cmd/Ctrl+Enter submits from any field.

PopoverFooter

Also takes every <div> attribute.

On this page