damianricobelli / stepperize

A library for creating step-by-step workflows in your apps
https://stepperize.vercel.app
917 stars 40 forks source link

Add `index` property for steps #66

Closed wottpal closed 1 month ago

wottpal commented 1 month ago

It's useful to get an (automatic) index value for each step, e.g. when showing something like "Step {index} of {total}".

Currently I'm using a small helper function like:

function getStepIndex(step: (typeof steps)[number]) {
  return steps.findIndex((_step) => step.id === _step.id) as number
}
damianricobelli commented 1 month ago

In v3.1 an index is added to the current step. I can definitely add this

wottpal commented 1 month ago

Oh sweet, yes that works perfectly fine. Didn't see this release yet.