import type { ElementType, MutableRefObject, RefCallback } from "react";
import type { Options, Props } from "../utils/types.ts";
declare const TagName = "div";
type TagName = typeof TagName;
/**
* Returns props to create a `Portal` component.
* @see https://ariakit.com/components/portal
* @example
* ```jsx
* const props = usePortal();
* Content
* ```
*/
export declare const usePortal: import("../utils/types.ts").Hook<"div", PortalOptions<"div">>;
/**
* Renders an element using [React
* Portal](https://react.dev/reference/react-dom/createPortal).
*
* By default, the portal element is a `div` element appended to the
* `document.body` element. You can customize this with the
* [`portalElement`](https://ariakit.com/reference/portal#portalelement) prop.
*
* The
* [`preserveTabOrder`](https://ariakit.com/reference/portal#preservetaborder)
* prop allows this component to manage the tab order of the elements. It
* ensures the tab order remains consistent with the original location where the
* portal was rendered in the React tree, instead of the final location in the
* DOM. The
* [`preserveTabOrderAnchor`](https://ariakit.com/reference/portal#preservetaborderanchor)
* prop can specify a different location from which the tab order is preserved.
* @see https://ariakit.com/components/portal
* @example
* ```jsx
* Content
* ```
*/
export declare const Portal: (props: PortalProps) => import("react").ReactElement>;
export interface PortalOptions<_T extends ElementType = TagName> extends Options {
/**
* When enabled, `preserveTabOrder` will keep the DOM element's tab order the
* same as the order in which the underlying
* [`Portal`](https://ariakit.com/reference/portal) component was mounted in
* the React tree.
*
* If the
* [`preserveTabOrderAnchor`](https://ariakit.com/reference/portal#preservetaborderanchor)
* prop is provided, the tab order will be preserved relative to that element.
* @default false
*/
preserveTabOrder?: boolean;
/**
* An anchor element for maintaining the tab order when
* [`preserveTabOrder`](https://ariakit.com/reference/portal#preservetaborder)
* prop is enabled. The tab order will be kept relative to this element.
*
* By default, the tab order is kept relative to the original location in the
* React tree where the underlying
* [`Portal`](https://ariakit.com/reference/portal) component was mounted.
* @example
* ```jsx {18-20}
* const [anchor, setAnchor] = useState(null);
*
*
*
*
* // Rendered at the end of the document.
*
*
*
*
* // Rendered at the end of the document, but the tab order is preserved.
*
*
*
*
* // Rendered at the end of the document, but the tab order is preserved
* // relative to the anchor element.
*
*
*
*
*
* ```
*/
preserveTabOrderAnchor?: Element | null;
/**
* `portalRef` is similar to `ref` but is scoped to the portal node. It's
* useful when you need to be informed when the portal element is appended to
* the DOM or removed from the DOM.
*
* Live examples:
* - [Form with Select](https://ariakit.com/examples/form-select)
* @example
* ```jsx
* const [portalElement, setPortalElement] = useState(null);
*
*
* ```
*/
portalRef?: RefCallback | MutableRefObject;
/**
* Determines whether the element should be rendered as a React Portal.
*
* Live examples:
* - [Combobox with integrated
* filter](https://ariakit.com/examples/combobox-filtering-integrated)
* - [Dialog with Menu](https://ariakit.com/examples/dialog-menu)
* - [Hovercard with keyboard
* support](https://ariakit.com/examples/hovercard-disclosure)
* - [Menubar](https://ariakit.com/components/menubar)
* - [Standalone Popover](https://ariakit.com/examples/popover-standalone)
* - [Animated Select](https://ariakit.com/examples/select-animated)
* @default true
*/
portal?: boolean;
/**
* An HTML element or a memoized callback function that returns an HTML
* element to be used as the portal element. By default, the portal element
* will be a `div` element appended to the `document.body`.
*
* Live examples:
* - [Navigation Menubar](https://ariakit.com/examples/menubar-navigation)
* @example
* ```jsx
* const [portal, setPortal] = useState(null);
*
*
*
* ```
* @example
* ```jsx
* const getPortalElement = useCallback(() => {
* const div = document.createElement("div");
* const portalRoot = document.getElementById("portal-root");
* portalRoot.appendChild(div);
* return div;
* }, []);
*
*
* ```
*/
portalElement?: ((element: HTMLElement) => HTMLElement | null) | HTMLElement | null;
}
export type PortalProps = Props>;
export {};