2.0.0-rc.4 • Published 9 months ago

@asphalt-react/wizard v2.0.0-rc.4

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
9 months ago

Wizard

npm

Wizard is a component that guides the user through a set of predefined steps and helps to complete a large task or a process. Each Step of Wizard supports multiple intents, and can present some optional content with it.

This pattern is also called as Progress stepper.

Usage

import { 
  Wizard, 
  Step, 
  StepContent, 
  StepIndicator, 
  StepLabel, 
  WizardPath 
} from '@asphalt-react/wizard'

<Wizard>
  <Step>
    <StepIndicator>1</StepIndicator>
    <StepContent>
      <StepLabel>User Info</StepLabel>
    </StepContent>
  </Step>
  <WizardPath/>
  <Step>
    <StepIndicator>2</StepIndicator>
    <StepContent>
      <StepLabel>User Preferences</StepLabel>
    </StepContent>
  </Step>
  <WizardPath/>
  <Step>
    <StepIndicator>3</StepIndicator>
    <StepContent>
      <StepLabel>Checkout</StepLabel>
    </StepContent>
  </Step>
</Wizard>

Unit Components

The Wizard component exports the Unit components:

  1. Step
  2. StepIndicator
  3. StepContent
  4. StepLabel
  5. StepDescription
  6. WizardPath

Unit components under Step accepts active prop, that can be used to indicate the current or highlighted step. They also accept a disabled to make any step appear unavailable to the user. All intents success, warning, danger & info can be set to the StepIndicator component, with neutral appearance being the default.

Building a Wizard

Think of building a Wizard, as a series of Step components, connected with WizardPath.

Each Step is composed of StepIndicator and optionally with StepLabel & StepDescription wrapped in a StepContent

Orientation

Wizard, by default renders itself and the steps horizontally. This can be changed by setting vertical prop to Wizard and WizardPath.

Props

vertical

Enables vertical variant

typerequireddefault
boolfalsefalse

children

Steps of wizard

typerequireddefault
nodetrueN/A

Step

Props

children

Accepts indicator and content.

typerequireddefault
nodetrueN/A

aside

Enable aside behaviour. Aside behaviour allows indicator and content to be arranged horizontally.

typerequireddefault
boolfalsefalse

StepIndicator

Props

children

Children for StepIndicator.

typerequireddefault
nodefalsenull

size

Controls size of the StepIndicator. Accepts m & l for medium & large respectively.

typerequireddefault
enumfalse"m"

aside

Enables aside mode.

typerequireddefault
boolfalseN/A

success

Applies success intent.

typerequireddefault
boolfalsefalse

info

Applies information intent.

typerequireddefault
boolfalsefalse

danger

Applies danger intent.

typerequireddefault
boolfalsefalse

warning

Applies warning intent.

typerequireddefault
boolfalsefalse

active

Active state of StepIndicator.

typerequireddefault
boolfalsefalse

disabled

Disabled state of StepIndicator.

typerequireddefault
boolfalsefalse

StepContent

Props

children

React node for content.

typerequireddefault
nodefalseN/A

aside

Enables aside mode.

typerequireddefault
boolfalseN/A

StepLabel

Props

children

Accepts text node for StepLabel.

typerequireddefault
nodefalseN/A

active

Active state of StepLabel.

typerequireddefault
boolfalsefalse

disabled

Disabled state of StepLabel.

typerequireddefault
boolfalsefalse

StepDescription

Props

children

React node for description.

typerequireddefault
nodetrueN/A

disabled

Disabled state of StepDescription.

typerequireddefault
boolfalsefalse

WizardPath

Props

completed

Completed state for WizardPath.

typerequireddefault
boolfalsefalse

vertical

Vertical mode for WizardPath.

typerequireddefault
boolfalsefalse

aside

Assist in aside behaviour.

typerequireddefault
boolfalseN/A

size

Controls size of the WizardPath. Accepts s, m, l for small, medium & large.

typerequireddefault
enumfalse"m"