0.3.0 • Published 4 years ago

@procore/labs-multi-step-manager v0.3.0

Weekly downloads
28
License
SEE LICENSE IN LI...
Repository
github
Last release
4 years ago

Multi Step Manager

A component or hook that manages navigation. Provides the current step, as well as to and back functions to navigate.

Inspiration: Routeless non sequential UIs, modal driven confirmation steps.

Install

yarn add @procore/labs-multi-step-manager

Import

import {
  // a hook to push history onto an array
  useMultiStepManager,
  // a component with a render prop of the hook
  MultiStepManager,
  // a component that keys into its child object
  MultiStepManagerRenderFromObject,
} from '@procore/labs-multi-step-manager';

Usage

function Example() {
  const { current, to } = useMultiStepManager({ initialStep: 'ONE' });

  return (
    <MultiStepManagerRenderFromObject current={current}>
      {{
        ONE: <Button onClick={to('NEXT')}>Next</Button>,
        NEXT: <Button onClick={to('ONE')}>Restart</Button>,
      }}
    </MultiStepManagerRenderFromObject>
  );
}
0.3.0

4 years ago

0.2.0

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.3

7 years ago

0.1.4

7 years ago