GitHub 560+

Popover

Displays rich content in a floating layer, triggered by a button.

Installation

npx shadcn@latest add @fulldev/popover

Usage

import { buttonVariants } from "@/components/ui/button"
import {
  Popover,
  PopoverContent,
  PopoverDescription,
  PopoverHeader,
  PopoverTitle,
  PopoverTrigger,
} from "@/components/ui/popover"
<Popover>
  <PopoverTrigger class={buttonVariants({ variant: "outline" })}>
    Open Popover
  </PopoverTrigger>
  <PopoverContent align="start">
    <PopoverHeader>
      <PopoverTitle>Popover title</PopoverTitle>
      <PopoverDescription>Add any rich content here.</PopoverDescription>
    </PopoverHeader>
  </PopoverContent>
</Popover>

Composition

Use the following composition to build a Popover:

Popover
├── PopoverTrigger
└── PopoverContent
    └── PopoverHeader
        ├── PopoverTitle
        └── PopoverDescription

Examples

Alignments

Use the align prop on PopoverContent to control the horizontal alignment.

With Form

A popover with form fields inside.

API Reference

See the GitHub source code for more information on props. See the data-slot docs for more information on interactivity.