@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.
43 lines (42 loc) • 1.47 kB
TypeScript
import * as React from 'react';
import { GenericHTMLProps } from '../../utils/types.js';
export declare function useMenuTrigger(parameters: useMenuTrigger.Parameters): useMenuTrigger.ReturnValue;
export declare namespace useMenuTrigger {
interface Parameters {
/**
* Whether the component should ignore user interaction.
* @default false
*/
disabled?: boolean;
/**
* The ref to the root element.
*/
rootRef?: React.Ref<HTMLElement>;
/**
* A callback to set the trigger element whenever it's mounted.
*/
setTriggerElement: (element: HTMLElement | null) => void;
/**
* Whether the menu is currently open.
*/
open: boolean;
/**
* A callback to set the open state of the Menu.
*/
setOpen: (open: boolean, event: Event | undefined) => void;
allowMouseUpTriggerRef: React.RefObject<boolean>;
positionerRef: React.RefObject<HTMLElement | null>;
}
interface ReturnValue {
/**
* Resolver for the trigger's props.
* @param externalProps props for the root slot
* @returns props that should be spread on the root slot
*/
getTriggerProps: (externalProps?: GenericHTMLProps) => GenericHTMLProps;
/**
* The ref to the trigger element.
*/
triggerRef: React.RefCallback<Element> | null;
}
}