Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-form-stepper

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-form-stepper

React stepper component for multiple step forms

  • 2.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8.9K
decreased by-13.99%
Maintainers
1
Weekly downloads
 
Created
Source

react-form-stepper

version GitHub Workflow Status (branch) David David License Downloads

NPM

A simple react stepper component for multi-step forms inspired by the Stepper component from Material-UI.

react-form-stepper preview

Examples

For examples of react-form-stepper go to: https://m0ky.github.io/react-form-stepper/.

Getting started

Install the library by running:

npm install react-form-stepper --save

or

yarn add react-form-stepper

Usage

import { Stepper } from 'react-form-stepper';

There are 2 possible ways of defining the steps in the Stepper component:

  • Using the steps prop
  • Using the Stepper as a HOC with Step as children

Using the steps prop

<Stepper
  steps={[{ label: 'Step 1' }, { label: 'Step 2' }, { label: 'Step 3' }]}
  activeStep={2}
/>

Using the Stepper as a HOC with Step as children

<Stepper activeStep={1}>
  <Step label="Children Step 1" />
  <Step label="Children Step 2" />
  <Step label="Children Step 3" />
</Stepper>

Using with SSR

When developing an SSR application with a framework like Next.js you might face your console being polluted with the following message Warning: [JSS] Rule is not linked. Missing sheet option "link: true". caused by the underlying dependency react-jss. A workaround is to use the dynamic import module like in the example below.

// CustomStepper.js
const CustomStepper = () => {
  return <Stepper steps={[{ label: 'Step 1' }, { label: 'Step 2' }]} activeStep={1} />;
};

export default CustomStepper;
// MultiStepForm.js
import dynamic from 'next/dynamic';

const StepperComponent = dynamic(() => import('./CustomStepper'), {
  ssr: false,
});

Stepper props

PropsOptionsDefaultDescription
steps[StepsDTO]noneArray of objecst defining the steps
activeStepnumber0Value defining the active step
connectorStateColorsbooleanfalseUse different colors for connector lines based on adjacent steps state
classNamestringnoneAdd css classes to the Stepper component
stepClassNamestringnoneAdd css classes to Step components
hideConnectorsboolean |'inactive'falseValue defining connectors visibility
nonLinearbooleanfalseAllow users to enter the flow at any point
styleConfigStepStyleDTO---Object containing Step style defaults
connectorStyleConfigConnectorStyleProps---Object containing Connector style defaults

ConnectorStyleProps

PropsOptionsDefaultDescription
disabledColorstring'#bdbdbd'Define the disabled connector line color
activeColorstring'#ed1d24'Define the active connector line color
completedColorstring'#a10308'Define the completed connector line color
sizeReact.ReactText1Define the thickness of the connector line
stepSizeReact.ReactText'2em'Value defaulting to the step size, used to calculate the padded space between the step and connector line start
stylestring'solid'Define the style of the connector line

StepsDTO

PropsOptionsDefaultDescription
labelstring''Value to be displayed under each step
activebooleanfalseValue to indicate should the step be displayed as active
completedbooleanfalseValue to indicate should the step be displayed as completed

StepStyleDTO

PropsOptionsDefaultDescription
activeBgColorstring'#ed1d24'Define the background color for active steps
activeTextColorstring'#ffffff'Define the text color for active steps
completedBgColorstring'#a10308'Define the background color for completed steps
completedTextColorstring'#ffffff'Define the background color for completed steps
inactiveBgColorstring'#e0e0e0'Define the background color for inactive steps
inactiveTextColorstring'#ffffff'Define the background color for inactive steps
sizestring or number'2em'Value representing the width and height of the step
circleFontSizestring or number'1rem'Font size of the step content
labelFontSizestring or number'0.875rem'Font size of step labels
borderRadiusstring or number'50%'Step border radius
fontWeightstring or number500Step label font weight

Step props

PropsOptionsDefaultDescription
labelstring''Value to be displayed under each step
activebooleanfalseValue to indicate should the step be displayed as active
completedbooleanfalseValue to indicate should the step be displayed as completed
indexnumber0Index value of the step
classNamestringnoneAdd css classes to the Step component
childrenReact.ReactNodeStep indexValue inside the step

Keywords

FAQs

Package last updated on 31 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc