Skip to content
MIZU.

Popover

A small panel that opens beside its button for settings and filters, closing when you look away.

View .md

Live — this one is real

Usage

tsx
import { Popover, Checkbox } from "mizu-ui";

export function Example() {
  return (
    <Popover label="Columns">
      <fieldset className="mizu-form-fields">
        <legend className="mizu-field-label">Show columns</legend>
        <Checkbox label="Owner" defaultChecked />
        <Checkbox label="Severity" defaultChecked />
        <Checkbox label="Last updated" />
      </fieldset>
    </Popover>
  );
}

Source & setup

Add this component to your project with the shadcn CLI. The command copies its source into your configured UI directory, with base.css, Mizu’s tokens, and the stylesheets that hold its rules. Each rule lives in one stylesheet, so components you add together never repeat CSS. In a project without a components.json, run npx shadcn@latest init 0xuser64bit/mizu/preset first: plain init installs shadcn’s theme into your global CSS. Then load the fonts.

sh
npx shadcn@latest add 0xuser64bit/mizu/popover 0xuser64bit/mizu/checkbox

The example also uses Checkbox, so the command adds it too.

Every component imports from its own path, its name in kebab case. To paste the example, replace its mizu-ui import with:

tsx
import { Popover } from "@/components/ui/mizu/popover";
import { Checkbox } from "@/components/ui/mizu/checkbox";

For npm imports, import mizu-ui/styles.css once. Fonts are optional via mizu-ui/fonts.css. Override --mizu-* tokens or use className for local styling. Uses native React and CSS; install the package peers for root imports. A Client Component: its source starts with “use client”.

Inspect composite/Popover.tsx

Source is included in the npm package under src/composite/Popover.tsx.

Open full source ↗

Props

PropTypeDefaultDescription
labelstring—Button text and the panel's accessible name.
childrenReactNode—The panel's content.
side / align"bottom" | "top" / "start" | "end""bottom" / "start"Where the panel opens. It flips to the other side when there is no room.

Accessibility

Built on the native Popover API: Escape or a click outside closes it and returns focus to the button, which reports aria-expanded. The panel is a non-modal dialog named by its button, and follows the button in the tab order.

Motion

The panel settles 4px into place; reduced motion opens it still.

Works alongside