soda-material
Version:
A React(>=18) component library that may follow [Material Design 3](https://m3.material.io/components) (a.k.a. Material You)
38 lines (37 loc) • 1.51 kB
TypeScript
import * as Soda from '@/components/menu';
import * as React from 'react';
export interface NestedMenuProps extends Soda.Props {
/**
* Provide a ReactNode to toggle the menu.
* Context menu should not provide this property
*/
label?: React.ReactNode;
/**
* Do not need to specify this property in the most cases
*/
nested?: boolean;
children?: React.ReactNode;
defaultOpen?: boolean;
/**
* If set to true, the component can be a context menu (right click the document to show)
*/
contextMenu?: boolean;
/**
* Which element to trigger the context menu, e.g.
* `contextMenuSource.addEventListener('contextmenu', onContextMenu)`
* @default document
*/
contextMenuSource?: HTMLElement;
}
/**
* If contextMenu property is not provided,
* the root menu must has a label property, which will toggle the whole menu,
* any sub menu in it will automatically become a `<MenuItem>`.
*
* These two components add logic to `<Menu>` `<MenuItem>` components.
* Refer relative components documentd to see how to use.
*
* Based on floating-ui, supports keyboard navigation.
*/
export declare const NestedMenu: React.ForwardRefExoticComponent<NestedMenuProps & Omit<React.HTMLProps<HTMLElement>, "as" | "ref" | keyof NestedMenuProps> & React.RefAttributes<HTMLElement>>;
export declare const NestedMenuItem: React.ForwardRefExoticComponent<Soda.Props & React.HTMLAttributes<HTMLElement> & React.RefAttributes<HTMLElement>>;