Paper-stepper is an element made with Polymer with respect to the material specifications.
Steppers display progress through a sequence by breaking it up into multiple logical and numbered steps. They may also be used for navigation.
Spec recommendation: Avoid using steppers to break up sections in a short form, or multiple times on one page and don’t embed steppers within steppers.
Start using now bower install -S Zecat/paper-stepper#v2.0-beta.5
Note, it is still a beta release, attributes and methods might change suddenly.
Paper-stepper is a container for paper-step's. Give a label to your steps, once the user tap the primary button, the step is saved and the stepper progress. He can come back to update a saved step if it has editable attribute set.
Include any content you want in a step, simply ensure that the contents for each step are responsive and don’t embed steppers within steppers. If the content overflow, the step will be scrollable.
The stepper is non-linear by default, which allow users to enter a multi-step flow at any point whereas a linear stepper requires users to complete one step in order to move on to the next.
optional steps don't bloc the progression in linear stepper [Missing feature]. You can configure the text displayed which default to "optional" with optional-text attribute.
Paper-step implement IronValidatableBehavior. Override _getValidity() method on a step to create your own validation logique.
Paper-stepper is horizontal by default. Horizontal steppers are ideal when the contents of one step depend on an earlier step. Avoid using long step names in horizontal steppers.
The alternative label take effect in horizontal layout and allows slightly longer labels.
Use the vertical layout for narrow screen sizes, when your labels are too long or when you have too many steps. It is ideal for mobile.
If you specify --paper-stepper-vertical-responsive-width, the stepper manage the vertical attribute itself. When the width of the stepper (not the viewport width!) is inferior to the variable, the vertical layout is use.
For performance reason, the responsive check is debounced according to responsive-check-frequence which default to 200ms.
Resize your window to see the effect.
You can configure the text of the above buttons with back-text and skip-text attributes.
The text of the primary button correspond to continue-text attribute by default, update-text if the step is saved and finish-text if it is the last unsaved step. Texts are capitalized within the buttons.
In vertical layout, the height of the stepper depends on his steps and in an opened horizontal stepper, it defaults to 450px.
Use the following variables instead of setting 'height' and 'max-height', they allow to configure the stepper and its steps depending on the layout.
Paper-stepper implement IronSelectableBehavior. By default, selected reflet the selected index (the first step has index 0). Give a default value to selected for the step to be opened when the user land on the stepper.
Note: The behavior is slightly modified to only allow the selection of selectable steps.
You can use attr-for-selected for selected to reflect an attribute on your step.
You can define animations between steps in horizontal layout. Import your animations and set
to the name of the wanted animation, directly on paper-stepper or on a specific paper-step.
You can bind these attributes to be notified of changes about the stepper and its steps.
In horizontal layout, labels are overflow ellipsis and will be revealed on hover. For long labels, prefer use alternative label or vertical layout.
By-product: This demo is made with iron-scroll-spy, fork!
Change on an attribute will be immediately reflected.