UNPKG

@julio-soto/react-compare-slider

Version:

A slider component to compare any two React components in landscape or portrait orientation. It supports custom images, videos... and everything else.

22 lines (21 loc) 1.11 kB
import React from 'react'; import { ReactCompareSliderCommonProps, ReactCompareSliderPropPosition } from './types'; /** Comparison slider properties. */ export interface ReactCompareSliderProps extends Partial<ReactCompareSliderCommonProps> { /** Padding to limit the slideable bounds in pixels on the X-axis (landscape) or Y-axis (portrait). */ boundsPadding?: number; /** Custom handle component. */ handle?: React.ReactNode; /** First item to show. */ itemOne: React.ReactNode; /** Second item to show. */ itemTwo: React.ReactNode; /** Whether to only change position when handle is interacted with (useful for touch devices). */ onlyHandleDraggable?: boolean; /** Callback on position change with position as percentage. */ onPositionChange?: (position: ReactCompareSliderPropPosition) => void; /** If true it handles image position on hover */ changePositionOnHover?: boolean; } /** Root Comparison slider. */ export declare const ReactCompareSlider: React.FC<ReactCompareSliderProps & React.HtmlHTMLAttributes<HTMLDivElement>>;