npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

use-stepper-react

v1.0.1

Published

Tiny React hook for multi-step forms and wizards with full TypeScript support

Readme

use-stepper — Headless React Hook for Multi-Step Wizards

npm version npm downloads CI TypeScript License: MIT Bundle size

A headless React hook for type-safe multi-step wizard navigation — no wrapper components, no providers, just a hook. Zero dependencies.

const { current, next, back, progress } = useStepper({
  steps: ["account", "profile", "review"] as const,
});
// current is "account" | "profile" | "review" — not number

Tiny, headless, zero dependencies. Works with any UI library.

use-stepper demo — multi-step form wizard with progress bar and type-safe navigation

Why

| | use-stepper | react-use-wizard | Custom useState | | ------------------------ | --------------------------------- | ------------------------ | ----------------- | | Pure hook | Yes — no providers, no components | No — requires <Wizard> | Yes | | Type-safe step names | Yes — as const literal types | No — index-based | Manual | | Linear mode | Built-in | No | Manual | | Progress tracking | Built-in (0→1) | No | Manual | | Dependencies | 0 (peer: react) | 0 (peer: react) | — |

Install

npm install use-stepper

Quick Start

import { useStepper } from "use-stepper";

const STEPS = ["account", "profile", "review"] as const;

function SignupWizard() {
  const { current, isFirst, isLast, next, back, progress } = useStepper({
    steps: STEPS,
    onComplete: () => console.log("Done!"),
  });

  return (
    <div>
      <progress value={progress} />
      {current === "account" && <AccountForm />}
      {current === "profile" && <ProfileForm />}
      {current === "review" && <ReviewStep />}
      <button onClick={back} disabled={isFirst}>
        Back
      </button>
      <button onClick={next}>{isLast ? "Submit" : "Next"}</button>
    </div>
  );
}

API

useStepper(options)

const stepper = useStepper({
  steps: ["a", "b", "c"] as const, // required — step names
  initial: "b", // optional — start step (default: first)
  linear: true, // optional — restrict goTo() to visited steps
  onComplete: () => {}, // optional — called when next() on last step
});

Returns

| Property | Type | Description | | ---------- | ---------------- | -------------------------------------------- | | current | Steps[number] | Current step name | | index | number | Current step index (0-based) | | steps | Steps | The steps array you passed in | | isFirst | boolean | Whether current step is the first | | isLast | boolean | Whether current step is the last | | progress | number | Progress from 0 to 1 | | next() | () => void | Go to next step (calls onComplete if last) | | back() | () => void | Go to previous step (no-op if first) | | goTo() | (step) => void | Jump to a named step | | reset() | () => void | Reset to initial step |

Linear Mode

When linear: true, goTo() only allows jumping to steps you've already visited (or the next unvisited step). next() and back() are unaffected.

const stepper = useStepper({
  steps: ["shipping", "payment", "confirm"] as const,
  linear: true,
});

stepper.goTo("confirm"); // blocked — haven't visited "payment" yet
stepper.next(); // → "payment"
stepper.goTo("confirm"); // now allowed

Patterns

Conditional Steps

const steps = showOptional
  ? (["info", "optional", "done"] as const)
  : (["info", "done"] as const);

const stepper = useStepper({ steps });

With React Hook Form

const stepper = useStepper({
  steps: ["details", "address", "confirm"] as const,
});

async function handleNext() {
  const valid = await trigger(); // validate current form section
  if (valid) stepper.next();
}

Step Indicator

{
  stepper.steps.map((step, i) => (
    <button
      key={step}
      onClick={() => stepper.goTo(step)}
      aria-current={step === stepper.current ? "step" : undefined}
    >
      {i + 1}. {step}
    </button>
  ));
}

Author

Ofer Shapira

LinkedIn GitHub

License

MIT © Ofer Shapira