components icon indicating copy to clipboard operation
components copied to clipboard

Implement Alternative labels in Stepper component

Open demisx opened this issue 9 years ago • 7 comments

Bug, feature request, or proposal:

Feature request

What is the expected behavior?

Add an ability to display labels below step number. See the "Alternative labels" section on https://material.io/guidelines/components/steppers.html#steppers-types-of-steppers

What is the current behavior?

Apparently, placing labels under step numbers is not currently supported in Angular Material. At least, I didn't find anything in the docs.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular 2+, All browsers

demisx avatar Nov 10 '17 21:11 demisx

Do we have any update on this or any temporary fix to make it work. I want to place the labels below the step number.

manish7singh avatar Jan 04 '18 17:01 manish7singh

Here is my workaround:

  • on xs devices I hide the labels as they don't fit anyways screen shot 2018-01-08 at 15 38 06

  • on sm devices I did my best to follow the official guidelines. screen shot 2018-01-08 at 15 38 56

I couldn't figure out how to to make the lines in between go 8px right next to the icons, any contributions are welcome.

Also I didn't do anything for optional labels.

@media (max-width: 479px) {
  .mat-horizontal-stepper-header .mat-step-icon, .mat-horizontal-stepper-header .mat-step-icon-not-touched {
    margin-right: 0 !important;
  }
  .mat-step-label {
    display: none !important;
  }
}

@media (min-width: 480px) and (max-width: 767px) {
  .mat-stepper-horizontal {
    padding-left: 8px;
    padding-right: 8px;
  }
  .mat-horizontal-stepper-header {
    flex-direction: column;
    flex: 1;
    height: 104px !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
  .mat-horizontal-stepper-header .mat-step-icon, 
  .mat-horizontal-stepper-header .mat-step-icon-not-touched {
    margin-top: 24px;
    margin-right: 0 !important;
  }
  .mat-step-label {
    margin-top: 16px;
    width: 100%;
  }
  .mat-step-text-label {
    text-align: center;
  }
  .mat-stepper-horizontal-line {
    margin-top: -32px !important;
    max-width: 32px;
  }
}

philip-firstorder avatar Jan 08 '18 14:01 philip-firstorder

@philip-firstorder-io : Can you share your html file for the same? This isn't working for me.

rahul2270 avatar Mar 23 '18 19:03 rahul2270

@philip-firstorder You can use negative margins to bring the horizontal line closer to where you want them.

.mat-stepper-horizontal-line { border-top-width: 2px !important; margin: -38px -60px 0 -60px !important; }

image

tiagoseminotti avatar Aug 13 '18 11:08 tiagoseminotti

Please don't forget ::ng-deep, e.g.

::ng-deep .mat-step-header {
    border-radius: 50%;
}

lin-zy1229 avatar Sep 03 '18 09:09 lin-zy1229

We added support for this a couple of major versions ago. Closing this issue.

https://material.angular.io/components/stepper/overview#label-position

devversion avatar May 25 '20 20:05 devversion

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.