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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@keyvaluesystems/react-stepper

v1.0.4

Published

A fully customizable stepper component

Downloads

1,203

Readme

React Stepper

A fully customizable ready to use stepper UI package for React. Try tweaking a stepper using this codesandbox link here

Installation

The easiest way to use react-stepper-ui-component is to install it from npm and build it into your app with Webpack.

npm install  @keyvaluesystems/react-stepper

You’ll need to install React separately since it isn't included in the package.

Note for Next.js users, if you are using Next.js version 13 or later, you will have to use the use client feature to ensure proper compatibility.

Usage

React Stepper can run in a very basic mode by just providing the steps and currentStepIndex props like this:

<Stepper
  steps={[
    {
      stepLabel: "Step 1",
      stepDescription: "This is Step 1",
      completed: true,
    },
    {
      stepLabel: "Step 2",
      stepDescription: "This is Step 2",
      completed: false,
    },
    {
      stepLabel: "Step 3",
      stepDescription: "This is Step 3",
      completed: false,
    },
  ]}
  currentStepIndex={1}
/>

The steps array is an array of objects with following keys:

  • stepLabel - A mandatory string representing the label/title of the step.
  • stepDescription - Optional extra information or description for the step.
  • completed - Boolean flag for indicating step completion status.

You can customize each step node with your own DOM element using the renderNode prop

<Stepper
  steps={stepsArray}
  currentStepIndex={currentStepIndex}
  renderNode={(step, stepIndex) => <div key={stepIndex}>{step.stepLabel}</div>}
/>

The step param provided by the renderNode callback is the same object you pass as array item in steps prop.

Props

Props that can be passed to the component are listed below:

Style Customizations

All the default styles provided by this package can be overridden using the styles prop Below code shows how to override the default styles of completed steps, connector lines and current active step

import React from "react";
import Stepper from "react-stepper";

function App() {

  const styles = {
    LineSeparator: () => ({
      backgroundColor: "#028A0F",
    }),
    ActiveNode: () => ({
      backgroundColor: "#028A0F",
    }),
    CompletedNode: () => ({
      backgroundColor: "#028A0F",
  };

  return (
    <Stepper
      steps={stepsArray}
      currentStepIndex={currentStepIndex}
      styles={styles}
    />
  );
}

export default App;

Additional customizations can be made by overriding the customizable styles listed below:

const stylesOverride = {
    LabelTitle: (step, stepIndex) => ({ ...styles }),
    ActiveLabelTitle: (step, stepIndex) => ({ ...styles }),
    LabelDescription: (step, stepIndex) => ({ ...styles }),
    ActiveLabelDescription: (step, stepIndex) => ({ ...styles }),
    LineSeparator: (step, stepIndex) => ({ ...styles }),
    InactiveLineSeparator: (step, stepIndex) => ({ ...styles }),
    Node: (step, stepIndex) => ({ ...styles }),
    ActiveNode: (step, stepIndex) => ({ ...styles }),
    InActiveNode: (step, stepIndex) => ({ ...styles }),
  };
  • LabelTitle - overrides the step label style
  • ActiveLabelTitle - overrides the step label style of current active step
  • LabelDescription - overrides the step description style
  • ActiveLabelDescription - overrides the step description style of current active step
  • LineSeparator - overrides default completed step connector line styles
  • InactiveLineSeparator - overrides styles of step connector line after current active step
  • Node - overrides default styles of step indicator
  • ActiveNode - overrides default styles of step indicator of current active step
  • InActiveNode - overrides default styles of step indicator that is not completed and not active
  • CompletedNode - overrides default styles of completed step indicator