Skip to content
Ginga UI
Ginga UI
日本語

Getting started

  • Overview
  • Quick start
  • Theme generation
  • Custom rendering
  • All components

Forms

  • Button
  • Checkbox
  • Input
  • Radio
  • Questionnaire
  • SegmentedControl
  • Select
  • ComboBox
  • NumberField
  • SearchField
  • Slider
  • Switch
  • FormControl

Display

  • Accordion
  • Alert
  • AlertDialog
  • Badge
  • CodeBlock
  • Card
  • Dialog
  • Drawer
  • Image
  • List
  • Popover
  • Menu
  • Tooltip
  • Table
  • Tab
  • Toast
  • Trace

Typography

  • Heading
  • Paragraph

Navigation

  • Anchor

Layout

  • Box

Resources

  • Changelog
  • GitHub (opens in a new tab)

Logo: Twemoji (opens in a new tab) (CC-BY 4.0)

Popover

A popover anchored to a trigger element. Placement and arrow display are customizable.

View in Storybook (opens in a new tab)

Installation

import { Popover } from "@ginga-ui/core";

Basic usage

A simple popover shown below its trigger. Supports focus management and keyboard interaction.

popover.tsx
import { Button, Popover, PopoverTrigger } from "@ginga-ui/core";
import { Info } from "lucide-react";

export function BasicExample() {
  return (
    <PopoverTrigger>
      <Button variant="filled" startIcon={<Info />}>
        Show details
      </Button>
      <Popover>
        <p>This is the popover content.</p>
      </Popover>
    </PopoverTrigger>
  );
}

Placement

Use the placement prop to set the position, such as top, bottom, left, or right.

popover.tsx
popover.module.css
import { Button, Popover, PopoverTrigger } from "@ginga-ui/core";
import styles from "./popover.module.css";

export function PlacementsExample() {
  return (
    <div className={styles.placementList}>
      {(["top", "bottom", "left", "right"] as const).map((placement) => (
        <PopoverTrigger key={placement}>
          <Button variant="outline">{placement}</Button>
          <Popover placement={placement}>
            <p>Appears on the {placement}.</p>
          </Popover>
        </PopoverTrigger>
      ))}
    </div>
  );
}

Without arrow

Pass false to the showArrow prop to hide the arrow.

popover.tsx
import { Button, Popover, PopoverTrigger } from "@ginga-ui/core";

export function WithoutArrowExample() {
  return (
    <PopoverTrigger>
      <Button variant="light">No arrow</Button>
      <Popover showArrow={false}>
        <p>A popover without an arrow.</p>
      </Popover>
    </PopoverTrigger>
  );
}

Props

PopoverTrigger

Accepts the props of React Aria's DialogTrigger (opens in a new tab).

Popover

NameTypeDefaultDescription
childrenReactNode-Content of the popover. It is wrapped in a dialog.
showArrowbooleantrueShows an arrow pointing at the trigger. The offset grows by half the arrow size.
placementPlacement"bottom"Position of the popover relative to the trigger.
offsetnumber8Distance from the trigger in pixels.

Also accepts the props of React Aria's Popover (opens in a new tab).