Popover

updated

Rich content in a floating panel anchored to a trigger.

Demo

Installation

Usage

<script setup lang="ts">
import { Button } from '@/components/ui/button'
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
</script>

<template>
  <Popover>
    <PopoverTrigger as-child>
      <Button variant="outline" color="neutral">Open</Button>
    </PopoverTrigger>
    <PopoverContent>Place content for the popover here.</PopoverContent>
  </Popover>
</template>

Put anything inside. It opens below the trigger and moves to stay on screen. Escape or a click outside closes it.

Want it anchored to something else, like the input your button sits in? Wrap that element in PopoverAnchor.

Examples

By default, the page stays clickable: a click outside closes the popover and also hits whatever is under it.

Add modal, and the page locks while it's open: focus stays inside, scrolling stops, and a click outside only closes the popover.

Modal

API Reference

PopoverContent accepts class, merged over its base classes.

Data attributes

data-slotAttributesDescription
popover-contentdata-state, data-side, data-alignThe panel.
popover-scrim—The transparent layer under a modal popover that takes the first outside click.

Changelog

  1. registry 0.23.0

    bc6008b — Exits now use the decelerating curve, like entrances. Collapsible, Accordion, the overlay surfaces (Popover, Select, Menu, Tooltip), Drawer, Toast and InnerLoading used to close on --ease-emphasized-accelerate, which holds still for most of its duration and then snaps shut; closing on --ease-standard-decelerate starts at once and settles gently, so the same duration feels faster. The tokens themselves are unchanged.

  2. core 0.17.0

    0107e40 — The scrollbar's space is kept only while an overlay locks scrolling, as Base UI does, instead of on every page. @kappa-ui/core/tailwind.css no longer sets html { scrollbar-gutter: stable }, so a page too short to scroll no longer shows an empty strip along its edge on Windows. Dialog, Drawer, Select, Menu, Popover and DatePicker set scrollbar-gutter: stable on <html> while the page is locked and it would otherwise scroll, and remove it afterwards; a gutter your stylesheet already reserves is left alone. Keep ConfigProvider with :scroll-body="false". Want the old always-on gutter? Add html { scrollbar-gutter: stable; } to your stylesheet.

    bc6008b — Exits now use the decelerating curve, like entrances. Collapsible, Accordion, the overlay surfaces (Popover, Select, Menu, Tooltip), Drawer, Toast and InnerLoading used to close on --ease-emphasized-accelerate, which holds still for most of its duration and then snaps shut; closing on --ease-standard-decelerate starts at once and settles gently, so the same duration feels faster. The tokens themselves are unchanged.

  3. registry 0.22.0

    ee25b0f — The modal scrim's hold renders a comment instead of a hidden <span>, and PopoverContent, DatePickerContent and Menu put it after their slot: PopoverContent as-child renders the consumer's element as the panel instead of moving the panel's role, classes and data-slot onto the hidden span, and a panel's first element child is the consumer's again.

    a751cf6 — ScrollArea measures its content in layout pixels, as it measures its viewport: under a scaled ancestor, and in a Dialog, Popover or Menu that opens with the default scale-in, the content was measured short for its whole life, so the thumb came out too long, the end fade dropped out and reachEdge fired early.

  4. core 0.16.0

    ee25b0f — The modal scrim's hold renders a comment instead of a hidden <span>, and PopoverContent, DatePickerContent and Menu put it after their slot: PopoverContent as-child renders the consumer's element as the panel instead of moving the panel's role, classes and data-slot onto the hidden span, and a panel's first element child is the consumer's again.

  5. registry 0.17.0

    7951a0f — New Marker: an inline status, a bordered row or a labelled separator, from shadcn-vue, with a color. New Banner: a full-width notice with a title, a subtitle, actions and a close button, v-model:open and color. New Tour: parts over Popover for a guided tour driven by useTour. Skeleton takes a color.