React Popover
A glass React popover anchored to its trigger, for small forms and details; Escape or a click outside closes it. Use Popover as a glass popover for a small filter panel opened from a toolbar button, where a few controls and an Apply action fit in a panel anchored to the button.
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/popover.jsonDocument
PopoverPopoverClosePopoverTitlePopoverContentPopoverTrigger- +5 more
- +2 more
Share link
import { Button } from "@/components/sheenui/button/button";
import { Input } from "@/components/sheenui/input/input";
import { Popover, PopoverClose, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger } from "@/components/sheenui/popover/popover";
// Package build (after the first npm release, or a packed tarball): import { Button, Input, Popover, PopoverClose, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger } from "@sheenui/theme";
// This example also uses button, input: npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/button.json https://lokendra-builds.github.io/sheenui/r/input.json
export function Example() {
return (
<Popover>
<PopoverTrigger render={<Button variant="glass" />}>Share</PopoverTrigger>
<PopoverContent>
<PopoverTitle>Share this page</PopoverTitle>
<PopoverDescription>Anyone with the link can view it.</PopoverDescription>
<Input readOnly defaultValue="https://example.com/blocks" />
<PopoverClose render={<Button size="sm" />}>Done</PopoverClose>
</PopoverContent>
</Popover>
);
}Files to copy
5 folders · 6 files · 4 packages
- From
theme/src/ components/popover/components/drawer/parts/sheet.tsxhooks/{use-latest.ts, use-media-query.ts}lib/{cn.ts, form.ts, popup-motion.ts}styles/
- shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/popover.jsonRegistry item: popover. The styles need the Tailwind v4 glass UI setup.- The examples also use
components/button/components/input/components/spinner/hooks/{use-magnetic.ts, use-preferences.ts}motion/{gate.ts, tokens.ts}lib/{field-size.ts, state-light.tsx}
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/button.json https://lokendra-builds.github.io/sheenui/r/input.json- Packages
pnpm add @base-ui/react clsx motion tailwind-merge
Placement and a controlled panel
side and align place the panel; open and onOpenChange let your code close it after saving.
import { useState } from "react";
import { Button } from "@/components/sheenui/button/button";
import { Input } from "@/components/sheenui/input/input";
import { Popover, PopoverContent, PopoverTitle, PopoverTrigger } from "@/components/sheenui/popover/popover";
// Package build (after the first npm release, or a packed tarball): import { Button, Input, Popover, PopoverContent, PopoverTitle, PopoverTrigger } from "@sheenui/theme";
// This example also uses button, input: npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/button.json https://lokendra-builds.github.io/sheenui/r/input.json
export function Example() {
const [open, setOpen] = useState(false);
const [name, setName] = useState("Q3 roadmap");
return (
<Popover open={open} onOpenChange={setOpen}>
<PopoverTrigger render={<Button variant="glass" />}>{name}</PopoverTrigger>
<PopoverContent side="right" align="start" className="flex w-72 flex-col gap-3">
<PopoverTitle>Rename</PopoverTitle>
<Input label="Name" value={name} onChange={(event) => setName(event.target.value)} />
<Button size="sm" onClick={() => setOpen(false)}>Save</Button>
</PopoverContent>
</Popover>
);
}Bottom sheet on phones
mobile='sheet' presents the panel as a bottom sheet under 640px wide, modal with a drag handle and swipe-to-dismiss. The default, 'popup', keeps the anchored panel. Press “Preview on a phone” to try it on a desktop screen (or narrow the window).
import { Button } from "@/components/sheenui/button/button";
import { Popover, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger } from "@/components/sheenui/popover/popover";
// Package build (after the first npm release, or a packed tarball): import { Button, Popover, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger } from "@sheenui/theme";
// This example also uses button: npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/button.json
export function Example() {
return (
<Popover mobile="sheet">
<PopoverTrigger render={<Button variant="glass">Details</Button>} />
<PopoverContent>
<PopoverTitle>Billing</PopoverTitle>
<PopoverDescription>Next invoice on 1 Dec.</PopoverDescription>
</PopoverContent>
</Popover>
);
}Props
PopoverContent props
PopoverLabels keys and English defaults (1)
Keyboard
Accessibility
- The trigger gets aria-expanded and aria-haspopup; the panel is labeled by PopoverTitle when you render one.
- Use a Popover for interactive content; use a Tooltip for a short label and a HoverCard for a preview.
- Under reduced motion the panel only fades.
All exports on this page
Popover— Glass popover: a small floating panel anchored to a button, for extra controls or details that do not deserve a full dialog.PopoverClose— A button inside PopoverContent that closes the popover (for "Done" or "Cancel" actions).PopoverContent— The glass panel of a Popover, portalled to the end of the body and positioned next to the trigger.PopoverDescription— Muted helper text under the title.PopoverTitle— The popover's heading.PopoverTrigger— The element that opens a Popover.defaultPopoverLabels— English defaults of PopoverLabels.
When to use Popover
- Use Popover for a Filters or Share button in a toolbar that opens a compact panel with a few fields and a confirm action, kept next to the button so the page behind stays in view.
- Use it for an account menu with a profile summary and a sign out button, or a share panel with a link field, where content stays near the trigger.
- Use side, align and sideOffset on PopoverContent to place the panel, knowing it flips to the other side when there is no room in the viewport.
- Skip it when the content is a plain hint or a list of commands. Use Tooltip for a label on hover, Menu for actions, and Dialog when the task needs the whole page's attention.
- Pair it with Button through the render prop on PopoverTrigger, Field and Switch for settings inside the panel, and Calendar when a date picker needs custom content.
Frequently asked questions
Related pages
67 components pages in all: browse them on All components.
By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .