NOCTA UI

Popover

Advanced popover component with smart positioning, collision detection, and smooth animations for displaying rich content

Installation

Install the Popover component using the nocta-ui CLI:

npx nocta-ui add popover

Import the component:

import {
  Popover,
  PopoverTrigger,
  PopoverContent
} from '@/components/ui/popover';

Example

The Popover component provides a floating panel that appears on demand, perfect for displaying additional information or controls.

Controlled State

Control the popover's open state programmatically using the open and onOpenChange props.

State: Closed

Api Reference

Popover

PropTypeDefaultDescription
openbooleanControlled open state
defaultOpenbooleanfalseDefault open state
onOpenChange(open: boolean) => voidCallback when open state changes

PopoverTrigger

PropTypeDefaultDescription
variant'default''default'Visual style of the trigger
size'sm' | 'md' | 'lg''md'Trigger size
asChildbooleanfalseRender as child element instead of button
classNamestring''Additional CSS classes

PopoverContent

PropTypeDefaultDescription
size'sm' | 'md' | 'lg''md'Content size (padding, typography)
classNamestring''Additional CSS classes
portalbooleantrueRender content in a portal
fixedbooleanfalseUse CSS position: fixed for the popover

The Popover component also accepts all standard HTML attributes for their respective elements.