@helpwave/hightide
Version:
helpwave's component and theming library
43 lines (40 loc) • 1.09 kB
text/typescript
import { Dispatch, SetStateAction } from 'react';
type UseHoverStateProps = {
/**
* The delay after which the menu is closed in milliseconds
*
* default: 200ms
*/
closingDelay: number;
/**
* Whether the hover state management should be disabled
*
* default: false
*/
isDisabled: boolean;
};
type UseHoverStateReturnType = {
/**
* Whether the element is hovered
*/
isHovered: boolean;
/**
* Function to change the current hover status
*/
setIsHovered: Dispatch<SetStateAction<boolean>>;
/**
* Handlers to pass on to the component that should be hovered
*/
handlers: {
onMouseEnter: () => void;
onMouseLeave: () => void;
};
};
/**
* @param props See UseHoverStateProps
*
* A react hook for managing the hover state of a component. The handlers provided should be
* forwarded to the component which should be hovered over
*/
declare const useHoverState: (props?: Partial<UseHoverStateProps> | undefined) => UseHoverStateReturnType;
export { useHoverState };