Skip to content

[Mat-Stepper] A few suggestions #7700

Closed

Description

@christikaes

Thanks for everyone who works on this project! I just upgraded to beta12 and am using the Stepper component now. I had a few proposals after using it for a bit. Please let me know what you think-I'd love to help contribute if we want any of these (:

  1. Mat-Stepper with horizontal/vertical as an input.
    • Use Case: I have a stepper that I want to toggle between horizontal/vertical for different screen aspect ratios but with the same content and steps. Currently I would need to create two separate components and toggle between the two which feels messy.
    • Proposal: Replace mat-vertical-stepper and mat-horizontal-stepper with mat-stepper that takes in an input to toggle between the two views
  2. SelectedIndex as input.
  3. Reset Stepper.
    • Use Case: I want to reset the stepper. I am using formGroup.reset() to reset each form, but this does not reset the visited states of each one of the steps.
    • Proposal: Some way of resetting the stepper component to the initial state: First step is selected, Forms are reset, None of the steps have been touched etc.
  4. Animate Height.
    • Use Case: Currently the steps slide right/left but the height of the stepper does not transition smoothly.
    • Proposal: Transition the height of the steps when changing from one step to the other
      Let me know what you think~

Activity

  1. sam-lex commented on Oct 11, 2017

    @sam-lex

    Would like to add one more suggestion here as well:
    5. Disabled step. Or a way to add/remove steps.

    • Use Case: Additional steps depending on what is being selected in previous steps. (like a wizard form).

    I was able to add steps with something like this:

    <mat-step *ngFor="let invForm of inventoryForms"
        [stepControl]="invForm.form" [label]="invForm.item.product.name">
    </mat-step>

    but if I go back to previous step, and change it so that these additional steps aren't required, and setting this.inventoryForms = [], the steps are not removed from the stepper.
    Even wrapping it inside a <ng-container *ngIf="inventoryForms.length > 0"> did not work. 😞

  2. sam-lex commented on Oct 12, 2017

    @sam-lex

    I got a work-around, but is probably a bad idea 😅

    1. Make a reference to the stepper:
    <mat-vertical-stepper #stepper></mat-vertical-stepper>
    1. Then, on the .ts side:
    import { ViewChild } from '@angular/core';
    import { MatVerticalStepper } from '@angular/material';
    
    @ViewChild('stepper') stepper: MatVerticalStepper;
    
    clearAdditionalForms(): void {
      this.inventoryForms = [];
      this.stepper._stateChanged(); // <- this : Marks the component to be change detected.
    }
  3. justinwaite commented on Oct 13, 2017

    @justinwaite

    I would like to also leave a suggestion.
    6. Async step support. If each step is using it's own FormGroup, while using linear="true", the forms should be submitted before moving on to the next step.

  4. added
    feature
    on Oct 13, 2017
  5. davidrensh commented on Oct 20, 2017

    @davidrensh

    disabled attribute is must have.
    For example: we have 5 steps, step N is disabled by business logic. Then it should be gray out and not editable

  6. spongessuck commented on Oct 26, 2017

    @spongessuck

    Perhaps related to 4. Animate Height: having it animate the same way tab transitions where you see the current content slide out

  7. vegham commented on Nov 5, 2017

    @vegham

    Have any one a solution for suggestion 1? I tried quickly the same as in #8014 but ran into same issues.

  8. Misiu commented on Nov 21, 2017

    @Misiu

    As @jdeanwaite suggested async step support is critical.
    I need to create 5 step process, when user clicks Next I'd like to submit data from that step to server, so that user can come back later and resume process.

    linear="true" solves problem with disabling ability to move to next step before filling current, but there should be option to disable moving back. In my case when user submits current step by clicking Next he can't move back. Currently he can click Back button or use labels to navigate, so disable attribute is a must have for me.

  9. added
    P3
    on Nov 21, 2017
  10. 31 remaining items

  11. akvaliya commented on Mar 20, 2019

    @akvaliya

    @AGPX ok it should work now...
    https://stackblitz.com/edit/angular-mat-stepper-full-height

    joyo

    I want the same. But want stepper fix at the bottom of the page & section should scroll.

    Any idea how to achieve that.

  12. tonysamperi commented on Mar 20, 2019

    @tonysamperi

    @akvaliya if I remember correctly the stepper and the content are flex.
    You can swap the order with a simple rule: flex-direction: column-reverse

  13. kungufli commented on Aug 18, 2020

    @kungufli

    I'm trying to get the same style requested by @AGPX (horizontal stepper with the steps content cover all the available vertical space), but I'm struggling to get it. Even the workarounds suggested by @tonysamperi and @Springrbua aren't working for me, maybe they worked well when posted, but they don't for sure on version 10.1.3, that I'm using.

    Any suggestion?

  14. tonysamperi commented on Aug 18, 2020

    @tonysamperi

    @kungufli I suggest not using github as stackoverflow.
    I think you should create a post there and show what you've tried so far.
    I think you should at least create a stackblitz with your environment so that anyone can take a look and maybe help you out!

  15. crisbeto commented on Apr 23, 2021

    @crisbeto
    Member

    I believe that most of the suggestions here are now supported. I'll close the issue since these sorts of multi-feature-request issues tend to be difficult to follow.

  16. angular-automatic-lock-bot commented on May 24, 2021

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  17. locked and limited conversation to collaborators on May 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

P3area: cdk/stepperfeature

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions