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

react-progress-stepper-ts

v1.0.3

Published

<p align="center"> <br/> <img src="https://i.ibb.co/dKD1dYq/samir-repo.png"> <br/> </p>

Downloads

89

Readme

React Progress Stepper

Minimal and beautiful stepper for React.

⚙️ Installation

$ npm i react-progress-stepper-ts
$ yarn add react-progress-stepper-ts

✔️ Usage

import React from 'react';
import {
  Stepper,
  Step,
  useStepper,
} from "react-progress-stepper-ts";

export default const App = () => {
  const { step, incrementStep, decrementStep } = useStepper(0, 3);

  return (
    <>
      <Stepper step={step}>
        <Step></Step>
        <Step></Step>
        <Step></Step>
      </Stepper>
      <button onClick={decrementStep}>Prev</button>
      <button onClick={incrementStep}>Next</button>
    </>
  )
}

🔎 Modules

🔹 Stepper

| Property | Type | Description | | ---------- | ------- | --------------------------------------- | | step | Integer | State to track the current step | | vertical | Boolean | Toggle vertical view | | dark | Boolean | Toggle dark mode | | numbered | Boolean | Toggle if each step is numbered or not | | theme | Object | Customize the appearance of the stepper |

🔹 Step

| Property | Type | Description | | --------------- | -------- | ---------------------------- | | customContent | Function | Override step circle content |

🔹 Content

You can customize the content of each step, as the example below:

import React from 'react';
import {
  Stepper,
  Step,
  useStepper,
  StepNumber,
  StepTitle,
  StepStatus,
  StepDescription,
} from "react-progress-stepper-ts";

export default const App = () => {
const { step, incrementStep, decrementStep } = useStepper(0, 3);

return (
    <>
      <Stepper step={step}>
        <Step>
          <StepNumber />
          <StepTitle>Title</StepTitle>
          <StepStatus />
          <StepDescription>Description</StepDescription>
        </Step>
        <Step>
          <StepNumber />
          <StepTitle>Title</StepTitle>
          <StepStatus />
          <StepDescription>Description</StepDescription>
        </Step>
        <Step>
          <StepNumber />
          <StepTitle>Title</StepTitle>
          <StepStatus />
          <StepDescription>Description</StepDescription>
        </Step>
      </Stepper>
    </>
  )
}

StepNumber

| Property | Type | Description | | -------- | ------ | -------------- | | text | String | Customize text |

StepTitle

StepTitle comes with no property, you can pass text as children.

StepStatus

| Property | Type | Description | | --------------- | ------ | -------------- | | textProgress | String | Customize text | | textCompleted | String | Customize text | | textPending | String | Customize text |

StepDescription

StepDescription comes with no property, you can pass text as children.

🔹 useStepper

Hook to handle the state of stepper easily, you could write your own logic to handle the state.

To work properly you need to provide two arguments to useStepper:

  • Number of current step: starts from 0;
  • Number of total steps.

useStepper provides several utilities:

  • step: state to track the current step;
  • incrementStep: function to increment state by one;
  • decrementStep: function to decrement state by one;
  • goToStep: function to set state to a specific step number.

🎨 Theming and Style Overrides

You can customize the appearance of the stepper in two ways:

🔹 Using the theme object:

{
  light: {
    step: {
      pending: {
        background: "#ededed",
        color: "#a1a3a7",
      },
      progress: {
        background: "#3c3fed",
        color: "#ffffff",
      },
      completed: {
        background: "#23c275",
        color: "#ffffff",
      },
    },
    content: {
      pending: {
        stepNumber: { color: "#a1a3a7" },
        title: { color: "#a1a3a7" },
        status: { background: "#f2f2f2", color: "#a1a3a7" },
        description: { color: "#a1a3a7" },
      },
      progress: {
        stepNumber: { color: "#131b26" },
        title: { color: "#131b26" },
        status: { background: "#e7e9fd", color: "#3c3fed" },
        description: { color: "#131b26" },
      },
      completed: {
        stepNumber: { color: "#131b26" },
        title: { color: "#131b26" },
        status: { background: "#e9faf2", color: "#23c275" },
        description: { color: "#131b26" },
      },
    },
    progressBar: {
      pending: {
        background: "#ededed",
      },
      progress: {
        background: "#e7e9fd",
        fill: "#3c3fed",
      },
      completed: {
        background: "#e9faf2",
        fill: "#23c275",
      },
    },
  },
  dark: {
    step: {
      pending: {
        background: "#1a1a1a",
        color: "#767676",
      },
      progress: {
        background: "#19b6fe",
        color: "#ffffff",
      },
      completed: {
        background: "#23c275",
        color: "#ffffff",
      },
    },
    content: {
      pending: {
        stepNumber: { color: "#767676" },
        title: { color: "#767676" },
        status: { background: "#1a1a1a", color: "#767676" },
        description: { color: "#767676" },
      },
      progress: {
        stepNumber: { color: "#ece4d9" },
        title: { color: "#ece4d9" },
        status: { background: "#08374c", color: "#19b6fe" },
        description: { color: "#ece4d9" },
      },
      completed: {
        stepNumber: { color: "#ece4d9" },
        title: { color: "#ece4d9" },
        status: { background: "#0b3a23", color: "#23c275" },
        description: { color: "#ece4d9" },
      },
    },
    progressBar: {
      pending: {
        background: "#1a1a1a",
      },
      progress: {
        background: "#08374c",
        fill: "#19b6fe",
      },
      completed: {
        background: "#0b3a23",
        fill: "#23c275",
      },
    },
  },
}

🔹 Overriding the CSS using class names, example:

.step {
  width: 3em;
  height: 3em;
}

.step.progress {
  background: #6ab04c;
}

✏️ License and Credits

React Progress Stepper is released under the MIT license, feel free to use it, share and modify.