@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.
58 lines • 1.69 kB
TypeScript
import * as React from 'react';
import { BaseUIComponentProps, NativeButtonProps } from "../../utils/types.js";
import { MenuHandle } from "../store/MenuHandle.js";
/**
* A button that opens the menu.
* Renders a `<button>` element.
*
* Documentation: [Base UI Menu](https://base-ui.com/react/components/menu)
*/
export declare const MenuTrigger: MenuTrigger;
export interface MenuTrigger {
<Payload>(componentProps: MenuTriggerProps<Payload> & React.RefAttributes<HTMLElement>): React.JSX.Element;
}
export interface MenuTriggerProps<Payload = unknown> extends NativeButtonProps, BaseUIComponentProps<'button', MenuTrigger.State> {
children?: React.ReactNode;
/**
* Whether the component should ignore user interaction.
* @default false
*/
disabled?: boolean;
/**
* A handle to associate the trigger with a menu.
*/
handle?: MenuHandle<Payload>;
/**
* A payload to pass to the menu when it is opened.
*/
payload?: Payload;
/**
* How long to wait before the menu may be opened on hover. Specified in milliseconds.
*
* Requires the `openOnHover` prop.
* @default 100
*/
delay?: number;
/**
* How long to wait before closing the menu that was opened on hover.
* Specified in milliseconds.
*
* Requires the `openOnHover` prop.
* @default 0
*/
closeDelay?: number;
/**
* Whether the menu should also open when the trigger is hovered.
*/
openOnHover?: boolean;
}
export type MenuTriggerState = {
/**
* Whether the menu is currently open.
*/
open: boolean;
};
export declare namespace MenuTrigger {
type Props<Payload = unknown> = MenuTriggerProps<Payload>;
type State = MenuTriggerState;
}