Skip to content
SevenOne

Search documentation

Search pages and components

Popover

Rich content in a floating panel that opens from a trigger. It is 288px wide, with 16px padding and 16px text.

Installation

npx shadcn@latest add @sevenone/popover

Usage

import {
  Popover,
  PopoverContent,
  PopoverDescription,
  PopoverHeader,
  PopoverTitle,
  PopoverTrigger,
} from "@/components/ui/popover"

Examples

Dimensions

<Popover>
  <PopoverTrigger asChild>
    <Button variant="outline">Open popover</Button>
  </PopoverTrigger>
  <PopoverContent className="w-80">
    <div className="grid gap-4">
      <PopoverHeader>
        <PopoverTitle>Dimensions</PopoverTitle>
        <PopoverDescription>Set the dimensions for the layer.</PopoverDescription>
      </PopoverHeader>
      <div className="grid grid-cols-3 items-center gap-4">
        <Label htmlFor="width">Width</Label>
        <Input id="width" defaultValue="100%" className="col-span-2" />
      </div>
      …
    </div>
  </PopoverContent>
</Popover>

Accessibility

  • Focus moves into the popover when it opens, and Esc closes it and returns focus to the trigger.
  • Use a Dialog instead when people must respond before going on.
  • Use a Tooltip, not a Popover, for a short label on hover.