import { Box, Flex, IconButton, Step, StepDescription, StepIcon, StepIndicator, StepNumber, StepSeparator, StepStatus, StepTitle, Stepper, css, useSteps } from '@chakra-ui/react'; import React, { useCallback, useState } from 'react'; export const useMyStep = ({ defaultStep = 0, steps = [] }: { defaultStep?: number; steps: { title?: string; description?: string }[]; }) => { const { activeStep, goToNext, goToPrevious } = useSteps({ index: defaultStep, count: steps.length }); const MyStep = useCallback( () => ( {steps.map((step, index) => ( } incomplete={ {index + 1} } active={ {index + 1} } /> {step.title} ))} ), [steps, activeStep] ); return { activeStep, goToNext, goToPrevious, MyStep }; };