React Stepper Component
npm install @idui/react-stepper




``bash`
npm install --save @idui/react-stepper
`bash`
yarn add @idui/react-stepper
`jsx
import React, { useState } from 'react'
import styled from 'styled-components';
import Stepper from '@idui/react-stepper'
function Example() {
const [currentStep, setStep] = useState(0);
return
currentStepIndex={currentStep}
theme={{
colors: {
step: {
default: '#9552D4',
completed: '#580B9E',
},
progress: {
default: '#B4B4B4',
completed: '#11AFD9',
},
},
stepSize: 50,
progressWidth: 4,
progressTransitionDuration: 300,
}}
renderStep={({ data, completed, index }) => (
completed={completed}
>
{data}
)}
/>
}
const Step = styled.div
transition: 0.3s linear color;
transition-delay: 0.3s;
color: ${ifProp('completed', '#11AFD9', '#FFFFFF')};;`
`jsx
import React, { useState } from 'react'
import styled from 'styled-components';
import Stepper from '@idui/react-stepper'
function Example() {
const [currentStep, setStep] = useState(0);
const [currentStepProgress, setCurrentStepProgress] = useState(0);
return (
items={items}
currentStepIndex={currentStep}
currentStepProgress={currentStepProgress}
renderStep={({ data, completed, index }) => (
setCurrentStepProgress(0);
setStep(index);
}}
completed={completed}
>
{data}
)}
/>
onClick={() =>
setStep(currentStep === 0 ? items.length - 1 : currentStep - 1)
}
>
Previous
Current Step: {currentStep + 1}
onClick={() =>
setStep(currentStep === items.length - 1 ? 0 : currentStep + 1)
}
>
Next
currentStepProgress:
type="range"
min={0}
max={100}
step={1}
value={currentStepProgress}
onChange={(e) => setCurrentStepProgress(e.target.value)}
/>
({currentStepProgress}%)
);
}
const Container = styled.div
width: 500px;;
const Actions = styled.div
display: flex;
justify-content: center;
align-items: center;
margin-top: 20px;
& > *:not(:last-child) {
margin-right: 10px;
};
const CurrentStepProgress = styled.div
display: flex;
justify-content: center;
align-items: center;
margin-top: 20px;
input {
margin-left: 10px;
};
const Step = styled.div
transition: 0.3s linear color;
transition-delay: 0.3s;
color: ${ifProp('completed', '#11AFD9', '#FFFFFF')};;``
MIT © kaprisa57@gmail.com