Xzero UI
Pro library

Popover

A small anchored surface for contextual information.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui/popover
Live · keyboard ready

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui/popover

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { Popover, PopoverContent, PopoverTrigger } from "@/components/xzero/popover/popover";
import { Button } from "@/components/xzero/button/button";

export function ShareMenu() {
  return (
    <Popover>
      <PopoverTrigger asChild><Button variant="secondary">Share</Button></PopoverTrigger>
      <PopoverContent>
        <p>Anyone with the link can view.</p>
      </PopoverContent>
    </Popover>
  );
}

API reference

Popover

Radix Popover.Root. Holds open state.

PropTypeDefaultDescription
openboolean–Controlled open state.
defaultOpenbooleanfalseInitial open state when uncontrolled.
onOpenChange(open: boolean) => void–Called when the popover opens or closes.
modalbooleanfalseTraps focus and blocks outside interaction when true.

PopoverTrigger

Radix trigger that opts out of press-scale so the panel does not shift on open.

PropTypeDefaultDescription
...propsComponentPropsWithoutRef<typeof PopoverPrimitive.Trigger>–Radix trigger props, including asChild and ref.

PopoverContent

Portaled floating panel anchored to the trigger.

PropTypeDefaultDescription
align"start" | "center" | "end""start"Alignment against the trigger.
sideOffsetnumber6Gap from the trigger in px.
collisionPaddingnumber10Minimum distance from viewport edges in px.
...propsComponentPropsWithoutRef<typeof PopoverPrimitive.Content>–Radix content props such as side, className, and onOpenAutoFocus.

PopoverClose

Radix Popover.Close for an explicit dismiss button.

PropTypeDefaultDescription
...propsComponentPropsWithoutRef<typeof PopoverPrimitive.Close>–Radix close props, including asChild.

Keyboard interactions

KeysAction
Enter / SpaceOpens the popover from the trigger.
EscapeCloses the popover and returns focus to the trigger.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in overlays

Guidance for AI tools

Popover: A small anchored surface for contextual information. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components