Overlays

Popover

A small, floating UI element that appears near a trigger to show contextual information or actions. It enhances user experience with non-intrusive overlays.

Loading...

Installation

Install the component via the CLI in one command.

npx shadcn@latest add @intentui/popover

Composed components

When you install this component via the CLI, it automatically loads all composed components, so you don’t need to add them individually.

Manual installation

Use this approach if you prefer to install and wire up the component yourself instead of using the CLI.

npm install react-aria-components

Anatomy

import {
  Popover,
  PopoverBody,
  PopoverClose,
  PopoverContent,
  PopoverDescription,
  PopoverFooter,
  PopoverHeader,
  PopoverTitle,
  PopoverTrigger,
} from "@/components/ui/popover"
import { Dialog } from "@/components/ui/dialog"
<Popover>
  <PopoverTrigger>Open Popover</PopoverTrigger>
  <PopoverContent>
    <Dialog>
      <PopoverHeader>
        <PopoverTitle>Popover Title</PopoverTitle>
        <PopoverDescription>Popover Description</PopoverDescription>
      </PopoverHeader>
      <PopoverBody>Popover Body</PopoverBody>
      <PopoverFooter>
        <PopoverClose>Close</PopoverClose>
        <PopoverClose>Confirm</PopoverClose>
      </PopoverFooter>
    </Dialog>
  </PopoverContent>
</Popover>

Examples

Controlled

You can control the popover programmatically.

Loading...

Overlay arrow

Popovers come with an arrow that points to the trigger element, but it’s hidden by default. To display it, pass the arrow prop.

Loading...

Placement

You can change the placement of the popover by passing the placement prop.

Loading...

The list above shows the primary directions, but you can also use specific placements like bottom left or top right. Here are all the available placement options:

Primary DirectionPlacement
bottombottom, bottom left, bottom right, bottom start, bottom end
toptop, top left, top right, top start, top end
leftleft, left top, left bottom
startstart, start top, start bottom
rightright, right top, right bottom
endend, end top, end bottom

Custom close

You can easily close the popover by clicking outside of it, or add a custom close button inside using Popover.Close. Just make sure everything is wrapped inside a Dialog.

Loading...

Popover trigger

All the examples above use <Button/> as the trigger, but what if you wanna switch it up, like using <Avatar/> instead? No sweat, just roll with PopoverTrigger like this:

Loading...

Component API

Popover

The Popover component controls the popover trigger and content.

PopoverTrigger

The PopoverTrigger component defines the element that opens a popover.

PropTypeDefault
classNamestring-

PopoverContent

The PopoverContent component renders floating popover content.

PropTypeDefault
arrowbooleanfalse
classNamestring-

PopoverHeader

The PopoverHeader component groups the popover title and description.

PropTypeDefault
classNamestring-
descriptionstring-
titlestring-

PopoverTitle

The PopoverTitle component renders the popover heading.

PropTypeDefault
classNamestring-

PopoverDescription

The PopoverDescription component renders supporting text inside a popover.

PropTypeDefault
classNamestring-

PopoverBody

The PopoverBody component wraps the main popover content.

PropTypeDefault
classNamestring-

PopoverFooter

The PopoverFooter component groups popover actions.

PropTypeDefault
classNamestring-

PopoverClose

The PopoverClose component renders a button that closes the popover.

PropTypeDefault
classNamestring-
intent"primary" | "secondary" | "warning" | "danger" | "success" | "outline" | "plain"plain

See the React Aria for the full API reference.

Unlock the full power of
Intent UI Design

Build modern web apps faster with 1000+ resources across components, blocks, patterns, templates, and starter kits.

Learn more