react-scroll-snapper
Version:
Swipeable views for React using CSS scroll snap
25 lines (24 loc) • 800 B
TypeScript
import { type JSX } from "react";
/**
* Props for the {@link ScrollSnapper} component.
*/
export interface ScrollSnapperProps {
/**
* The current page index.
*
* Can be changed to programmatically scroll to a different page.
*/
index: number;
/**
* A callback which runs after the container is scrolled to a page.
*
* This will run even if the user scrolled but ended up on the same page.
*
* Scrolling triggered by changing the `index` prop will also trigger this callback after the animation is finished.
*/
onIndexChange: (index: number, target: HTMLDivElement) => void;
}
/**
* Scroll Snapper React component.
*/
export declare function ScrollSnapper(props: ScrollSnapperProps & React.HTMLProps<HTMLDivElement>): JSX.Element;