View as Markdown

API reference: @salmonui/overlays/popover

PopoverPropsinterface

import type { PopoverProps } from '@salmonui/overlays/popover';
interface PopoverProps {
    readonly children?: ReactNode;
    readonly open?: boolean | undefined;
    readonly defaultOpen?: boolean | undefined;
    readonly onOpenChange?: ((open: boolean, event: PopoverOpenChangeEvent) => void) | undefined;
    readonly placement?: PopoverPlacement | undefined;
    readonly offset?: PopoverOffset | undefined;
    readonly arrow?: boolean | undefined;
    readonly collisionBoundary?: Element | null | undefined;
    readonly anchor?: RefObject<Element | null> | undefined;
    readonly container?: Element | null | undefined;
    readonly closeOnOutsidePress?: boolean | undefined;
    readonly closeOnEscape?: boolean | undefined;
    readonly closeOnFocusOutside?: boolean | undefined;
    readonly initialFocus?: 'first' | 'container' | false | undefined;
    readonly returnFocus?: boolean | undefined;
}
PopoverProps members (15)
NameSignatureDescription
childrenoptionalreadonly children?: ReactNode;

Popover.Trigger and Popover.Content (any order, any depth).

openoptionalreadonly open?: boolean | undefined;
defaultOpenoptionalreadonly defaultOpen?: boolean | undefined;

Applied after hydration, so server and client markup stay identical.

onOpenChangeoptionalreadonly onOpenChange?: ((open: boolean, event: PopoverOpenChangeEvent) => void) | undefined;
placementoptionalreadonly placement?: PopoverPlacement | undefined;

Logical placement, resolved against dir. Default 'bottom'. Flips and shifts to stay inside the collision boundary.

offsetoptionalreadonly offset?: PopoverOffset | undefined;

Gap to the anchor in px (default 8), or { mainAxis, crossAxis }.

arrowoptionalreadonly arrow?: boolean | undefined;

Renders an arrow pointing at the anchor. Default false.

collisionBoundaryoptionalreadonly collisionBoundary?: Element | null | undefined;

Element whose box limits flip and shift (a scrolling container). Default the viewport.

anchoroptionalreadonly anchor?: RefObject<Element | null> | undefined;

Anchor element other than the trigger (a field the popover belongs to).

containeroptionalreadonly container?: Element | null | undefined;

Portal target for browsers without the Popover API (top layer otherwise). Default document.body.

closeOnOutsidePressoptionalreadonly closeOnOutsidePress?: boolean | undefined;

Close on a press outside the content and trigger. Default true.

closeOnEscapeoptionalreadonly closeOnEscape?: boolean | undefined;

Close on Escape. Default true.

closeOnFocusOutsideoptionalreadonly closeOnFocusOutside?: boolean | undefined;

Close when focus moves outside (Tab past the last control). Default true.

initialFocusoptionalreadonly initialFocus?: 'first' | 'container' | false | undefined;

Initial focus: the first tabbable control (default), the content element, or none.

returnFocusoptionalreadonly returnFocus?: boolean | undefined;

Return focus to the trigger on close. Default true.