reablocks
Version:
Component library for React
91 lines (89 loc) • 1.97 kB
TypeScript
import { MenuTheme } from './MenuTheme';
import { Modifiers, Placement } from '../../utils/Position';
import { OverlayEvent } from '../../utils/Overlay';
import { default as React, FC, LegacyRef } from 'react';
export interface MenuProps {
/**
* Whether to append the menu to the body or not.
*/
appendToBody?: boolean;
/**
* Autofocus the menu on open or not.
*/
autofocus?: boolean;
/**
* The menu contents.
*/
children: any | (() => any);
/**
* CSS class applied to menu element.
*/
className?: string;
/**
* Close the menu on click or not.
*/
closeOnBodyClick?: boolean;
/**
* Close the menu on escape.
*/
closeOnEscape?: boolean;
/**
* floating-ui placement type.
*/
placement?: Placement;
/**
* Reference element for the menu position.
*/
reference?: any;
/**
* CSS Properties for the menu.
*/
style?: React.CSSProperties;
/**
* Whether to show the menu or not.
*/
open?: boolean;
/**
* Max height of the menu.
*/
maxHeight?: string;
/**
* floating-ui Position modifiers.
*/
modifiers?: Modifiers;
/**
* Whether the menu should be the same width as the reference element
*/
autoWidth?: boolean;
/**
* Min width of the menu.
*/
minWidth?: number;
/**
* Max width of the menu.
*/
maxWidth?: number;
/**
* Menu was closed.
*/
onClose?: (event: OverlayEvent) => void;
/**
* Mouse enter event.
*/
onMouseEnter?: (event: any) => void;
/**
* Mouse leave event.
*/
onMouseLeave?: (event: any) => void;
/**
* Theme for the Menu.
*/
theme?: MenuTheme;
}
export interface MenuRef {
/**
* Reference to the menu element.
*/
ref?: LegacyRef<HTMLDivElement>;
}
export declare const Menu: FC<MenuProps & MenuRef>;