@fluentui/react-northstar
Version:
A themable React component library.
54 lines (53 loc) • 2.03 kB
TypeScript
import { AccessibilityAttributes } from '@fluentui/accessibility';
import { AccessibilityHandlerProps, FocusTrapZoneProps } from '@fluentui/react-bindings';
import * as React from 'react';
import { FluentComponentStaticProps } from '../../types';
import { ChildrenComponentProps, ContentComponentProps } from '../../utils';
export declare type TriggerAccessibility = {
attributes?: AccessibilityAttributes;
keyHandlers?: AccessibilityHandlerProps;
};
export interface PortalProps extends ChildrenComponentProps, ContentComponentProps {
/** Initial value of open. */
defaultOpen?: boolean;
/**
* Called when the portal is mounted on the DOM.
*
* @param data - All props.
*/
onMount?: (props: PortalProps) => void;
/**
* Called when the portal is unmounted from the DOM.
*
* @param data - All props.
*/
onUnmount?: (props: PortalProps) => void;
/** Controls whether or not the portal is displayed. */
open?: boolean;
/** Element to be rendered in-place where the portal is defined. */
trigger?: JSX.Element;
/** Controls whether or not focus trap should be applied, using boolean or FocusTrapZoneProps type value */
trapFocus?: FocusTrapZoneProps | boolean;
/** Accessibility behavior object to apply on trigger node. */
triggerAccessibility?: TriggerAccessibility;
/** Sets trigger node to passed ref. */
triggerRef?: React.Ref<any>;
/**
* Called when trigger node was clicked.
*
* @param data - All props.
*/
onTriggerClick?: (e: React.MouseEvent) => void;
/**
* Called when `click` event was invoked outside portal or trigger nodes.
*
* @param data - All props.
*/
onOutsideClick?: (e: React.MouseEvent) => void;
}
/**
* (DEPRECATED) A Portal allows to render children outside of their parent.
*
* @deprecated Please use "Popup" or "Dialog" components instead.
*/
export declare const Portal: React.FC<PortalProps> & FluentComponentStaticProps<PortalProps>;