@base-ui-components/react
Version:
Base UI is a library of headless ('unstyled') React components and low-level hooks. You gain complete control over your app's CSS and accessibility features.
77 lines • 2.88 kB
TypeScript
import * as React from 'react';
import type { BaseUIChangeEventDetails } from "../../utils/createBaseUIEventDetails.js";
/**
* Groups all parts of the popover.
* Doesn’t render its own HTML element.
*
* Documentation: [Base UI Popover](https://base-ui.com/react/components/popover)
*/
export declare function PopoverRoot(props: PopoverRoot.Props): React.JSX.Element;
export declare namespace PopoverRoot {
export interface State {}
interface Parameters {
/**
* Whether the popover is initially open.
*
* To render a controlled popover, use the `open` prop instead.
* @default false
*/
defaultOpen?: boolean;
/**
* Whether the popover is currently open.
*/
open?: boolean;
/**
* Event handler called when the popover is opened or closed.
*/
onOpenChange?: (open: boolean, eventDetails: ChangeEventDetails) => void;
/**
* Event handler called after any animations complete when the popover is opened or closed.
*/
onOpenChangeComplete?: (open: boolean) => void;
/**
* Whether the popover should also open when the trigger is hovered.
* @default false
*/
openOnHover?: boolean;
/**
* How long to wait before the popover may be opened on hover. Specified in milliseconds.
*
* Requires the `openOnHover` prop.
* @default 300
*/
delay?: number;
/**
* How long to wait before closing the popover that was opened on hover.
* Specified in milliseconds.
*
* Requires the `openOnHover` prop.
* @default 0
*/
closeDelay?: number;
/**
* A ref to imperative actions.
* - `unmount`: When specified, the popover will not be unmounted when closed.
* Instead, the `unmount` function must be called to unmount the popover manually.
* Useful when the popover's animation is controlled by an external library.
*/
actionsRef?: React.RefObject<Actions>;
/**
* Determines if the popover enters a modal state when open.
* - `true`: user interaction is limited to the popover: document page scroll is locked, and pointer interactions on outside elements are disabled.
* - `false`: user interaction with the rest of the document is allowed.
* - `'trap-focus'`: focus is trapped inside the popover, but document page scroll is not locked and pointer interactions outside of it remain enabled.
* @default false
*/
modal?: boolean | 'trap-focus';
}
export interface Props extends Parameters {
children?: React.ReactNode;
}
export interface Actions {
unmount: () => void;
}
export type ChangeEventReason = 'trigger-hover' | 'trigger-focus' | 'trigger-press' | 'outside-press' | 'escape-key' | 'close-press' | 'focus-out' | 'none';
export type ChangeEventDetails = BaseUIChangeEventDetails<ChangeEventReason>;
export {};
}