Popover Component

React popover component with rich content, twelve placement combinations, outside-click and Escape dismissal, controlled and uncontrolled modes.

Import

javascript
1import { Popover } from "@neuctra/ui";

Basic Usage

Click the trigger to toggle. Clicking outside or pressing Escape closes it.

Placement

position sets the side; align sets the edge alignment on that side.

Rich Content

Props

All available props for the Popover component.

PropTypeDefaultDescription
triggerReactNode—Element that toggles the popover (required)
childrenReactNode—Panel content (required)
position"top" | "bottom" | "left" | "right""bottom"Side of the trigger
align"start" | "center" | "end""center"Alignment along that side
open / defaultOpenboolean—Controlled / uncontrolled open state
onOpenChange(open: boolean) => void—Fired on every open/close
closeOnClickOutsidebooleantrueDismiss when clicking outside
closeOnEscapebooleantrueDismiss with the Escape key
disabledbooleanfalseDisable the trigger
classNamestring—Styles the root wrapper around trigger + panel.
triggerClassNamestring—Styles the wrapper around the trigger element.
contentClassNamestring—Styles the floating panel.
contentStyleCSSProperties—Inline styles for the floating panel.

Accessibility

  • The trigger exposes aria-haspopup="dialog", aria-expanded and aria-controls.
  • Enter and Space toggle the popover from the keyboard.
  • Document listeners attach only while open, and never go stale on onOpenChange.

Frequently Asked Questions

How do I install and import the Popover component?

Install the @neuctra/ui package, then import it with: import { Popover } from "@neuctra/ui";

Can I customize the Popover component's appearance?

Yes. Popover accepts a className prop for custom Tailwind CSS classes, so you can adjust spacing, layout, and styling without overriding the component internals.

Is the Popover component accessible?

Popover is built with semantic HTML and standard ARIA attributes, and supports keyboard navigation and focus states out of the box, so it works well with screen readers and keyboard-only users.

Built with React, Tailwind CSS & TypeScript.