12.7.2 • Published 2 years ago

@valentingavran/ngx-stepper v12.7.2

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

NgxStepper

An Angular stepper based on RxJS, which provides various events to make development easier. This library has no dependencies.

It includes a ready to use stepper implementation as well as the possibility to create your own stepper using the available services (similar to the Angular Material Stepper).

Table of contents

Installation

npm install @valentingavran/ngx-stepper

app.module.ts (or any other module)

import { NgxStepperModule } from '@valentingavran/ngx-stepper';

@NgModule({
  // ...
  imports: [
    // ...
    BrowserAnimationsModule, // Required for stepper animations
    NgxStepperModule, // Module that contains the stepper
  ],
})
export class AppModule {
}

Usage

app.component.html

<ngx-stepper #stepper>
  <ng-template ngxStep label="First step">
    First step content
    <button (click)="stepper.next()">Continue</button>
  </ng-template>
  <ng-template ngxStep label="Second step" [valid]="stepValid">
    Valid:<input type="checkbox" [(ngModel)]="stepValid" /><br />
    <button (click)="stepper.previous()">Back</button>
    <button ngxStepperNext>Continue</button>
  </ng-template>
  <ng-template ngxStep label="Third step">
    Third step content
    <button ngxStepperPrevious>Back</button>
    <button ngxStepperNext>Continue</button>
  </ng-template>
</ngx-stepper>

app.component.ts

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss'],
})
export class AppComponent {
  public stepValid = false;
}

API

ngx-stepper

Props

NameTypeDefaultDescription
stepConnectionLinebooleantrueActivates or deactivates the connection line of the stepper, which is visible at the left edge
headerNavigationbooleantrueActivates or deactivates the navigation via the step headers
orientationvertical or horizontalverticalSets the orientation of the stepper

Events

NameDescriptionEmits
onPreviousEmitted when the previous step is opened
onNextEmitted when the next step is opened"horizontal" or "vertical"
orientationChangeEmitted when the orientation changes
resetEmitted when the stepper is reset
stepChangeEmitted when the step selected step changesNgxStep

ngxStep

Props

NameTypeDefaultDescription
labelstring-Label of the step, that is displayed in the stepper header
validbooleantrueWith this field you can validate the current step. If the step is valid, you can navigate to the following steps. Otherwise it is not possible.

Events

NameDescriptionEmits
selectedChangeEmitted when the step gets selected or unselectedboolean
validChangeEmitted when the valid state of the step changesboolean
visitedChangeEmitted when the visited state of the step changesboolean

ngxStepperPrevious

This directive can be placed on a button, for example. After a click the stepper automatically goes to the previous step

<ngx-stepper>
  ...
  <ng-template ngxStep label="Step 2">
    Content 2
    <button ngxStepperPrevious>Back</button>
  </ng-template>
</ngx-stepper>

Alternatively you can call the previous method of a stepper reference:

<ngx-stepper #stepper>
  ...
  <ng-template ngxStep label="Step label">
    Content x
    <button (click)="stepper.previous()">Back</button>
  </ng-template>
</ngx-stepper>

In this case you can place the button also outside the stepper.

ngxStepperNext

This directive can be placed on a button, for example. After a click the stepper automatically goes to the next step

<ngx-stepper>
  <ng-template ngxStep label="Step label">
    Content x
    <button ngxStepperNext>Continue</button>
  </ng-template>
  ...
</ngx-stepper>

Alternatively you can call the next method of a stepper reference:

<ngx-stepper #stepper>
  <ng-template ngxStep label="Step label">
    Content x
    <button (click)="stepper.next()">Continze</button>
  </ng-template>
  ...
</ngx-stepper>

In this case you can place the button also outside the stepper.

12.7.0

2 years ago

12.7.1

2 years ago

12.6.2

2 years ago

12.7.2

2 years ago

12.6.3

2 years ago

12.6.4

2 years ago

12.5.0

2 years ago

12.5.1

2 years ago

12.4.0

2 years ago

12.3.2

2 years ago

12.3.1

2 years ago

12.3.0

2 years ago

12.2.2

2 years ago

12.2.1

2 years ago

12.2.0

2 years ago

12.1.0

2 years ago

12.0.2

2 years ago

12.0.1

2 years ago

12.0.0

2 years ago