pro-ui

Popover

Floating popover panel anchored to a trigger element. Good for contextual menus and info panels.

Import

import { Popover, Button } from '@dangbt/pro-ui'
import { DialogTrigger } from 'react-aria-components'

Basic usage

<DialogTrigger>
  <Button variant="ghost" size="sm">ⓘ Info</Button>
  <Popover>
    <p className="text-sm">This is additional context information.</p>
  </Popover>
</DialogTrigger>

With placement

<DialogTrigger>
  <Button>Options</Button>
  <Popover placement="bottom-end" showArrow={false}>
    <div className="flex flex-col gap-1 min-w-[160px]">
      <button className="text-sm text-left px-3 py-2 hover:bg-muted rounded">Edit</button>
      <button className="text-sm text-left px-3 py-2 hover:bg-muted rounded text-destructive">Delete</button>
    </div>
  </Popover>
</DialogTrigger>

Props

PropTypeDefaultDescription
placementPlacement'bottom'Placement relative to trigger
showArrowbooleantrueShow arrow pointing to trigger
childrenReactNodePopover content

On this page