@react-md/menu
Version:
Create menus that auto-position themselves within the viewport and adhere to the accessibility guidelines
23 lines (22 loc) • 1.04 kB
TypeScript
import { HTMLAttributes } from "react";
import { FocusType, VisibilityOptions } from "./useVisibility";
export interface ButtonVisibilityOptions extends VisibilityOptions {
onClick?: React.MouseEventHandler<HTMLButtonElement>;
onKeyDown?: React.KeyboardEventHandler<HTMLButtonElement>;
}
interface ReturnValue extends Required<Pick<HTMLAttributes<HTMLButtonElement>, "onClick" | "onKeyDown">> {
visible: boolean;
defaultFocus: FocusType;
hide: () => void;
}
/**
* This hook is used to provide the menu visibility based on interacting with
* the `MenuButton` component. It'll merge and return the required `onClick` and
* `onKeyDown` event handlers that should be passed down to the `MenuButton` as
* well as the current visibility state and a `hide` function to pass to the
* `Menu`.
*
* @private
*/
export declare function useButtonVisibility({ onClick: propOnClick, onKeyDown: propOnKeyDown, defaultVisible, defaultFocus: propDefaultFocus, onVisibilityChange, }?: ButtonVisibilityOptions): ReturnValue;
export {};