UNPKG

framer-motion

Version:

An open source and production-ready motion library for React on the web

67 lines (66 loc) • 1.68 kB
import { TargetAndTransition } from "../types"; import { EventInfo } from "../events/types"; import { VariantLabels } from "../motion/types"; import { VisualElement } from "../render/types"; /** * @public */ export interface HoverHandlers { /** * Properties or variant label to animate to while the hover gesture is recognised. * * @library * * ```jsx * <Frame whileHover={{ scale: 1.2 }} /> * ``` * * @motion * * ```jsx * <motion.div whileHover={{ scale: 1.2 }} /> * ``` */ whileHover?: VariantLabels | TargetAndTransition; /** * Callback function that fires when pointer starts hovering over the component. * * @library * * ```jsx * function onHoverStart(event) { * console.log("Hover starts") * } * * <Frame onHoverStart={onHoverStart} /> * ``` * * @motion * * ```jsx * <motion.div onHoverStart={() => console.log('Hover starts')} /> * ``` */ onHoverStart?(event: MouseEvent, info: EventInfo): void; /** * Callback function that fires when pointer stops hovering over the component. * * @library * * ```jsx * function onHoverEnd(event) { * console.log("Hover ends") * } * * <Frame onHoverEnd={onHoverEnd} /> * ``` * * @motion * * ```jsx * <motion.div onHoverEnd={() => console.log("Hover ends")} /> * ``` */ onHoverEnd?(event: MouseEvent, info: EventInfo): void; } export declare function useHoverGesture({ onHoverStart, onHoverEnd, whileHover }: HoverHandlers, visualElement: VisualElement): void;