Popover

A Popover component is a UI element that displays additional information or actions when users interact with a specific trigger, such as a button or link. It typically appears as a small overlay or tooltip that provides context, tips, or options without navigating away from the current page. Popovers enhance user experience by offering relevant content in a concise format while maintaining focus on the main interface.

Demo

Rendered live, with the same build of the library you install.

Usage

Popover.tsx
import { NButton, NPopover, PopoverSize } from '@nayan-ui/react';
const Popover = () => {
return (
<div>
<NPopover size={PopoverSize.MD} trigger={<NButton>Open Popover</NButton>}>
<div className="p-3">
<p className="text-foreground">This is popover content.</p>
</div>
</NPopover>
</div>
);
};
export default Popover;

Attributes

11 props
NameTypeDefaultDetails
sizePopoverSizeOptionalSize of the popover.
classNamestring' 'You can customise by passing tailwind classes.
triggerClassNamestring' 'You can customise by passing tailwind classes.
triggerReact.ReactElementRequiredTrigger element for the popover.
childrenReact.ReactNodeRequiredPopover content.
side'top' | 'bottom' | 'right' | 'left'OptionalSide where popover appears.
align'start' | 'end' | 'center'OptionalAlignment of the popover.
popoverIdstringOptionalID for the popover.
popoverLabelstringOptionalLabel for the popover.
triggerPropsReact.HTMLAttributes<HTMLElement>OptionalProps for trigger element.
contentPropsReact.HTMLAttributes<HTMLDivElement>OptionalProps for content element.

Tags

Other components solving nearby problems.