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 App = () => (
<Wizard
onStepChanged={({ activeStepIndex }) =>
console.log(`Step changed: ${activeStepIndex}`)
}
>
<Steps>
<Step id="country">
<Navigation
render={({ goToNextStep }) => {
return <CountrySelectionStep onSelected={goToNextStep} />;
}}
/>
</Step>
<Step id="customer">
<CustomerInformationStep />
</Step>
<Step id="offer">
<Navigation
render={({ goToNextStep }) => {
return <PaymentMethodSelectionStep onSelected={goToNextStep} />;
}}
/>
</Step>
</Steps>
</Wizard>
)
Controlled component
class App extends Component {
state = {
activeStepIndex: 0
};
render() {
return (
<Wizard activeStepIndex={this.state.activeStepIndex}>
<Steps>
<Step id="first">
<button onClick={() => this.setState({ activeStepIndex: 1 })}>
Go next step
</button>
</Step>
<Step id="second">
<button onClick={() => this.setState({ activeStepIndex: 0 })}>
Go prev step
</button>
</Step>
</Steps>
</Wizard>
);
}
}
Routed
class App extends Component {
render() {
return (
<Router>
<Route
path="/steps"
render={({ history, match: { url } }) => (
<Wizard history={history} baseUrl={url}>
<Steps>
<Step id="one">
<h1>Step 1</h1>
<Navigation
render={({ goToNextStep }) => {
return (
<button onClick={goToNextStep}>Go To Step 2</button>
);
}}
/>
</Step>
<Step id="two">
<h1>Step 2</h1>
<Navigation
render={({, goToPrevStep }) => {
return (
<button onClick={goToPrevStep}>Go To Step 1</button>
);
}}
/>
</Step>
</Steps>
</Wizard>
)}
/>
</Router>
);
}
}
Built With
Authors
- Vicent Gozalbes - Initial work - vigosan
License
This project is licensed under the MIT License - see the LICENSE.md file for details