@1imo/react-slider
v1.0.0
Published
A swipe-to-unlock style slider component built with React
Maintainers
Readme
React Slider
A swipe-to-unlock style slider component built with React.
Getting Started
Install Dependencies
npm installRun Storybook
npm run storybookThis will start Storybook on http://localhost:6006
Build Storybook
npm run build-storybookInstallation
npm install @1imo/react-sliderComponent Usage
import React, { useRef, useEffect } from 'react';
import Slider from '@1imo/react-slider';
function App() {
const verifiedRef = useRef(false);
useEffect(() => {
if (verifiedRef.current) {
console.log('Slider verified!');
// Do something when slider is verified
}
}, [verifiedRef.current]);
return <Slider verifiedRef={verifiedRef} />;
}Props
verifiedRef(optional): A ref object that will be set totruewhen the slider is successfully dragged to the end, and reset tofalseafter the animation completes.
Storybook Stories
The component includes several stories in Storybook:
- Default: Basic slider with console logging
- WithAlert: Slider with alert notification
- WithoutRef: Slider without verification tracking
