@react-md/menu
Version:
Create menus that auto-position themselves within the viewport and adhere to the accessibility guidelines
28 lines (27 loc) • 882 B
TypeScript
export declare type FocusType = "first" | "last";
export interface VisibilityState {
visible: boolean;
defaultFocus: FocusType;
}
export interface VisibilityOptions {
defaultVisible?: boolean;
defaultFocus?: FocusType;
onVisibilityChange?: (visible: boolean) => void;
}
interface ReturnValue {
visible: boolean;
defaultFocus: FocusType;
show: () => void;
showWithFocus: (defaultFocus: FocusType) => void;
hide: () => void;
toggle: () => void;
}
/**
* This is the main visibility hook to be used for the `DropdownMenu` and
* `DropdownMenuItem` components. It'll provide the current visibility as well
* as the default focus type once the menu becomes visible.
*
* @private
*/
export declare function useVisibility({ defaultVisible, defaultFocus: defaultFocusValue, onVisibilityChange, }?: VisibilityOptions): ReturnValue;
export {};