@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.
43 lines • 1.61 kB
TypeScript
import * as React from 'react';
import { type InteractionType } from '@base-ui-components/utils/useEnhancedClickHandler';
import type { DialogRoot } from "../root/DialogRoot.js";
import { HTMLProps } from "../../utils/types.js";
export declare function useDialogPopup(parameters: useDialogPopup.Parameters): useDialogPopup.ReturnValue;
export declare namespace useDialogPopup {
interface Parameters {
/**
* The ref to the dialog element.
*/
ref: React.Ref<HTMLElement>;
openMethod: InteractionType | null;
/**
* Event handler called when the dialog is opened or closed.
*/
setOpen: (open: boolean, event: Event | undefined, reason: DialogRoot.OpenChangeReason | undefined) => void;
/**
* The id of the title element associated with the dialog.
*/
titleElementId: string | undefined;
/**
* The id of the description element associated with the dialog.
*/
descriptionElementId: string | undefined;
/**
* Determines the element to focus when the dialog is opened.
* By default, the first focusable element is focused.
*/
initialFocus?: React.RefObject<HTMLElement | null> | ((interactionType: InteractionType) => React.RefObject<HTMLElement | null>);
/**
* Determines if the dialog should be mounted.
*/
mounted: boolean;
/**
* Callback to register the popup element.
*/
setPopupElement: React.Dispatch<React.SetStateAction<HTMLElement | null>>;
}
interface ReturnValue {
popupProps: HTMLProps;
resolvedInitialFocus: React.RefObject<HTMLElement | null> | number;
}
}