UNPKG

use-elevator

Version:

A React hook for smooth scrolling that transforms boring scroll-to-top actions into playful elevator experiences with customizable settings

24 lines (23 loc) 791 B
import { UseElevatorOptions, UseElevatorResult } from "./types"; /** * A React hook that provides a smooth scrolling effect. * Inspired by elevator.js but reimagined as a React hook with TypeScript support. * * @param {UseElevatorOptions} options - Configuration options for the elevator effect * @returns {UseElevatorResult} Object containing the startElevating function and isElevating state * * @example * ```jsx * const { startElevating, isElevating } = useElevator({ * duration: 2000, * targetElement: 'section-id' * }); * * return ( * <button onClick={startElevating} disabled={isElevating}> * {isElevating ? 'Going up...' : 'Back to top'} * </button> * ); * ``` */ export declare const useElevator: (options?: UseElevatorOptions) => UseElevatorResult;