Popover
cubby-ui/popoverFreeComponent
A popover component.
Live preview
live · rendered by the registry
Rendered by cubby-ui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://cubby-ui.dev/r/popover.jsonSource
1import * as React from "react";2import { Popover as BasePopover } from "@base-ui/react/popover";34import { cn } from "@/lib/utils";5import {6 solidSurface,7 type SurfaceLevel,8} from "@/registry/default/lib/elevated";910function Popover<Payload = unknown>({11 ...props12}: BasePopover.Root.Props<Payload>) {13 return <BasePopover.Root data-slot="popover" {...props} />;14}1516function PopoverPortal({ ...props }: BasePopover.Portal.Props) {17 return <BasePopover.Portal data-slot="popover-portal" {...props} />;18}1920function PopoverTrigger({ ...props }: BasePopover.Trigger.Props) {21 return <BasePopover.Trigger data-slot="popover-trigger" {...props} />;22}2324function PopoverClose({ ...props }: BasePopover.Close.Props) {25 return <BasePopover.Close data-slot="popover-close" {...props} />;26}2728function PopoverArrow({ ...props }: BasePopover.Arrow.Props) {29 return <BasePopover.Arrow data-slot="popover-arrow" {...props} />;30}3132function PopoverPositioner({ ...props }: BasePopover.Positioner.Props) {33 return <BasePopover.Positioner data-slot="popover-positioner" {...props} />;34}3536function PopoverViewport({ className, ...props }: BasePopover.Viewport.Props) {37 return (38 <BasePopover.Viewport39 data-slot="popover-viewport"40 // Same height and overflow policy as the viewport inside PopoverContent,41 // which see for why both the percentage and the cap are needed. Padding42 // is left to the caller; hand-composed popups own their own spacing.43 className={cn(44 "relative h-full max-h-(--available-height) w-full overflow-clip",45 "not-data-transitioning:overflow-y-auto",46 className,47 )}48 {...props}49 />50 );51}5253function PopoverPopup({54 className,55 level = 3,56 shadowLevel = 3,57 ...props58}: BasePopover.Popup.Props & {59 level?: SurfaceLevel;60 shadowLevel?: SurfaceLevel;61}) {62 return (63 <BasePopover.Popup64 data-slot="popover-popup"65 data-level={level}66 className={cn(67 "text-popover-foreground relative max-h-(--available-height) max-w-(--available-width) origin-(--transform-origin) rounded-xl outline-none",68 solidSurface(level, shadowLevel),69 className,70 )}71 {...props}72 />73 );74}7576function PopoverBackdrop({ className, ...props }: BasePopover.Backdrop.Props) {77 return (78 <BasePopover.Backdrop79 data-slot="popover-backdrop"80 className={cn(81// … truncated
What it pulls in
Other registry items
Files it writes
More from cubby-ui
All 79 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | cubby-ui | Components | Free | 2 deps | |
| Alertalert | cubby-ui | Components | Free | 1 dep | |
| Alert-dialogalert-dialog | cubby-ui | Components | Free | 2 deps | |
| Aspect-ratioaspect-ratio | cubby-ui | Components | Free | no deps | |
| Autocompleteautocomplete | cubby-ui | Components | Free | 2 deps | |
| Avataravatar | cubby-ui | Components | Free | 1 dep | |
| Badgebadge | cubby-ui | Components | Free | 1 dep | |
| Base Drawerbase-drawer | cubby-ui | Components | Free | 2 deps |
