@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.
72 lines (71 loc) • 2.24 kB
TypeScript
import * as React from 'react';
import { MenuOrientation } from './useMenuRoot.js';
/**
* Groups all parts of the menu.
* Doesn’t render its own HTML element.
*
* Documentation: [Base UI Menu](https://base-ui.com/react/components/menu)
*/
declare const MenuRoot: React.FC<MenuRoot.Props>;
declare namespace MenuRoot {
interface Props {
children: React.ReactNode;
/**
* Whether the menu is initially open.
*
* To render a controlled menu, use the `open` prop instead.
* @default false
*/
defaultOpen?: boolean;
/**
* Whether to loop keyboard focus back to the first item
* when the end of the list is reached while using the arrow keys.
* @default true
*/
loop?: boolean;
/**
* Whether the menu should prevent outside clicks and lock page scroll when open.
* @default true
*/
modal?: boolean;
/**
* Event handler called when the menu is opened or closed.
*/
onOpenChange?: (open: boolean, event?: Event) => void;
/**
* Whether the menu is currently open.
*/
open?: boolean;
/**
* The visual orientation of the menu.
* Controls whether roving focus uses up/down or left/right arrow keys.
* @default 'vertical'
*/
orientation?: MenuOrientation;
/**
* Whether the component should ignore user interaction.
* @default false
*/
disabled?: boolean;
/**
* When in a submenu, determines whether pressing the Escape key
* closes the entire menu, or only the current child menu.
* @default true
*/
closeParentOnEsc?: boolean;
/**
* How long to wait before the menu may be opened on hover. Specified in milliseconds.
*
* Requires the `openOnHover` prop.
* @default 100
*/
delay?: number;
/**
* Whether the menu should also open when the trigger is hovered.
*
* Defaults to `true` for nested menus.
*/
openOnHover?: boolean;
}
}
export { MenuRoot };