react-step-progress icon indicating copy to clipboard operation
react-step-progress copied to clipboard

Feature Request: Hooks for stepForward & stepBackward

Open r-bt opened this issue 4 years ago • 5 comments

Proposal

Expose a useStepProgress() hook which returns stepForward() & stepBackwards() to allow custom implementations of the Next and Previous Buttons

Reasoning

It would be great to separate some of the UI logic to allow better customization of the library. This way the buttonWrapperClass, primaryBtnClass, and secondaryBtnClass props can be removed and users can more easily make their own step forward / backwards navigation.

Other

If this is something you'd be interested in adding to the library, I'd be happy to submit a pull-request for it

r-bt avatar Jul 01 '20 08:07 r-bt

Thanks for the suggestion @richardbeattie . Will try to incorporate this.

saini-g avatar Jul 01 '20 09:07 saini-g

I was having a go at it and came up with this. It needs some work and refinements, but it gets the gist of the proposal.

r-bt avatar Jul 01 '20 09:07 r-bt

I'm looking forward to disable the primary or secondary button for example. That secondary button isn't showing on last step.

timo22h avatar Aug 13 '20 13:08 timo22h

any progress on this one? I really love the progress bar itself and don't need the buttons, so would like to remove the buttons completely. Any idea on how to achieve this?

yenicelik avatar May 01 '21 18:05 yenicelik

any progress on this one? I really love the progress bar itself and don't need the buttons, so would like to remove the buttons completely. Any idea on how to achieve this?

@yenicelik I'm not sure if this library is still being maintained so I've forked it to https://github.com/r-bt/react-stepz which incorporates this change so you can use it like

import { StepProgressBar, useStepProgress }

const { stepForward, stepBackwards } = useStepProgress(steps);

// Use stepForward & stepBackwards to handle moving back and forward however you want

return (
   <StepProgressBar steps={steps} />
)

r-bt avatar May 09 '21 09:05 r-bt