UNPKG

@mantine/core

Version:

React components library focused on usability, accessibility and developer experience

67 lines 2.8 kB
import React from 'react'; import { DefaultProps, MantineNumberSize } from '../../theme'; import { MantineTransition } from '../Transition/Transition'; import { MenuBody, MenuBodyProps, MenuBodyStylesNames } from './MenuBody/MenuBody'; import { MenuItem, MenuItemProps } from './MenuItem/MenuItem'; export { MenuBody, MenuItem }; export type { MenuBodyProps, MenuItemProps }; export declare const MENU_SIZES: { xs: number; sm: number; md: number; lg: number; xl: number; }; interface MenuPosition { top?: React.CSSProperties['top']; bottom?: React.CSSProperties['bottom']; left?: React.CSSProperties['left']; right?: React.CSSProperties['right']; } export interface MenuProps extends DefaultProps<MenuBodyStylesNames>, React.ComponentPropsWithoutRef<'div'> { /** <MenuItem /> and <Divider /> components only, children are passed to MenuBody component */ children: React.ReactNode; /** React element that will be used as menu control */ control?: React.ReactElement; /** Use opened and onClose props to setup controlled menu */ opened?: boolean; /** Called every time menu is closed */ onClose?(): void; /** Called every time menu is opened */ onOpen?(): void; /** Menu button aria-label and title props */ menuButtonLabel?: string; /** MenuBody component props */ menuBodyProps?: Record<string, any>; /** Transition styles */ transition?: MantineTransition; /** Transitions duration in ms */ transitionDuration?: number; /** Transition timing function */ transitionTimingFunction?: string; /** Predefined menu width or number for width in px */ size?: MantineNumberSize; /** Predefined shadow from theme or box-shadow value */ shadow?: string; /** Should menu close on item click */ closeOnItemClick?: boolean; /** Id attribute of menu */ menuId?: string; /** Menu dropdown position */ menuPosition?: MenuPosition; /** Control prop to get element ref */ controlRefProp?: string; /** Menu body z-index */ zIndex?: number; /** Get control ref */ elementRef?: React.ForwardedRef<HTMLButtonElement>; /** Event which should open menu */ trigger?: 'click' | 'hover'; /** Close delay for hover trigger */ delay?: number; } export declare function Menu({ control, children, onClose, onOpen, opened, themeOverride, menuPosition, style, menuId, menuBodyProps, closeOnItemClick, transitionDuration, size, shadow, transition, transitionTimingFunction, menuButtonLabel, controlRefProp, trigger, delay, zIndex, elementRef, classNames, styles, onMouseLeave, onMouseEnter, onChange, ...others }: MenuProps): JSX.Element; export declare namespace Menu { var displayName: string; } //# sourceMappingURL=Menu.d.ts.map