Popover

Floating content anchored to a trigger, for quick settings, details or a small form.

Status: beta. Category: Overlays.

import { Popover, PopoverTrigger, PopoverAnchor, PopoverContent, PopoverClose } from '@glyphui/ui'

Exports: Popover, PopoverTrigger, PopoverAnchor, PopoverContent, PopoverClose, popoverStyles.

Notes

  • Opens on click, closes on Escape or an outside click, and returns focus to the trigger.
  • For a hint on hover, use Tooltip. For a list of actions, use DropdownMenu.

Example: Share link

import { Button, Input, Popover, PopoverContent, PopoverTrigger, Text } from '@glyphui/ui'
import { Link2 } from 'lucide-react'

export default function Example() {
  return (
    <Popover>
      <PopoverTrigger asChild>
        <Button variant="outline" leftIcon={<Link2 />}>
          Share
        </Button>
      </PopoverTrigger>
      <PopoverContent align="start" className="grid w-80 gap-3">
        <div className="grid gap-1">
          <p className="font-medium">Share this view</p>
          <Text size="small" tone="muted">
            Anyone in the workspace with the link can see it.
          </Text>
        </div>
        <div className="flex gap-2">
          <Input readOnly defaultValue="glyph.app/acme/views/q3" aria-label="Link" />
          <Button size="md">Copy</Button>
        </div>
      </PopoverContent>
    </Popover>
  )
}

Example: With arrow

showArrow points the panel at its trigger.

import { Button, Popover, PopoverContent, PopoverTrigger, Text } from '@glyphui/ui'

export default function Example() {
  return (
    <Popover>
      <PopoverTrigger asChild>
        <Button variant="secondary">What’s new?</Button>
      </PopoverTrigger>
      <PopoverContent showArrow side="top">
        <Text size="small">Glyph 0.2 adds overlays, toasts and a confirm hook.</Text>
      </PopoverContent>
    </Popover>
  )
}

Live page: https://glyphui.xyz/components/popover