JSPM

  • Created
  • Published
  • Downloads 170
  • Score
    100M100P100Q77099F
  • License MIT

React library for building declarative wizards

Package Exports

  • react-wizr

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-wizr) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

react-wizr

React library for building declarative wizards

Example

Uncontrolled component

const WizardPage = () => (
  <div className="WizardPage">
    <Wizard
      onStepChanged={({ activeStepIndex }) =>
        console.log(`Step changed: ${activeStepIndex}`)}
    >
      <Steps>
        <Step>
          <Navigation
            render={({ goToNextStep }) => {
              return <CountrySelectionStep onSelected={goToNextStep} />;
            }}
          />
        </Step>
        <Step>
          <CustomerInformationStep />
        </Step>
        <Step>
          <Navigation
            render={({ goToNextStep }) => {
              return (
                <PaymentMethodSelectionStep onSelected={goToNextStep} />
              );
            }}
          />
        </Step>
      </Steps>
    </Wizard>
  </div>
);

Controlled component

class App extends Component {
  state = {
    activeStepIndex: 0
  }

  render() {
    return(
      <Wizard activeStepIndex={this.state.activeStepIndex}>
        <Steps>
          <Step>
            <button onClick={() => this.setState({ activeStepIndex: 1 })>Go next step</button>
          </Step>
          <Step />
        </Steps>
      </Wizard>;
    )   
  }
}

Built With

Authors

  • Vicent Gozalbes - Initial work - vigosan

License

This project is licensed under the MIT License - see the LICENSE.md file for details