Documentation

Popover

A floating panel next to its trigger, for a small form or details, closed by Escape or a click outside.

WebStableOverlays

Web only — React, from @krizaka/ui/popover. Stable: its API only changes in a major version.

When to use

  • For a small, optional task next to what it changes: set a goal, pick a filter, edit a name.
  • To show details on demand without leaving the page.

When not to use

  • For a list of actions.Use instead: Dropdown menu
  • For a short hint on hover or focus.Use instead: Tooltip
  • For a task that must be finished before going on.Use instead: Dialog

Installation

Install

npm install @krizaka/ui@beta @krizaka/tailwind@beta @krizaka/tokens@beta tailwindcss

Styles

@import "tailwindcss";
@import "@krizaka/tailwind";
@import "@krizaka/ui/tailwind.css";

Import

import { Popover } from "@krizaka/ui/popover";

Examples

A small form

A field and two buttons next to their trigger.

Props

PropTypeDefaultDescription
containerHTMLElement | null—The element the portal renders into (default: document.body).

Accessibility

  • Radix Popover: the trigger has aria-expanded and aria-controls; the content is a dialog.
  • It is not modal: the page stays reachable.

Keyboard

KeysAction
Enter / SpaceOpens the popover from its trigger; the focus moves into it.
EscCloses it and returns the focus to the trigger.

Best practices

  • Name the content with aria-label (or a heading inside) when the trigger's words are not enough.
  • Keep it small: if it scrolls, it should be a dialog or a page.
  • Put the close or cancel action in Popover.Close.

Generated from the code of @krizaka/ui 2.0.0-beta.6: its meta.ts, its examples and its types.Edit this documentation on GitHub

On this page