All Projects → tnicola → Ngx Joyride

tnicola / Ngx Joyride

Licence: mit
Angular Joyride/Tour library

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Ngx Joyride

Ngx Currency
📦 Currency mask module for Angular
Stars: ✭ 161 (+19.26%)
Mutual labels:  directive, angular2
Ng2 Pdfjs Viewer
An angular 8 component for PDFJS and ViewerJS (Supports angular 2/4/5/6/7)
Stars: ✭ 150 (+11.11%)
Mutual labels:  demo, angular2
Angular2 Express Mongoose Gulp Node Typescript
AngularJS 2 (Updated to 4.2.0) Mean Stack application which uses Angular2, Gulp, Express, Node, MongoDB (Mongoose) with Repository Pattern Business Layer
Stars: ✭ 201 (+48.89%)
Mutual labels:  tour, angular2
guide
A new feature guide component by react 🧭
Stars: ✭ 597 (+342.22%)
Mutual labels:  onboarding, tour
ngx-ui-tour
✈️ UI tour for Angular 9+ apps
Stars: ✭ 36 (-73.33%)
Mutual labels:  onboarding, tour
Showcaseview
🔦The ShowcaseView library is designed to highlight and showcase specific parts of apps to the user with an attractive and flat overlay.
Stars: ✭ 281 (+108.15%)
Mutual labels:  onboarding, tour
Ngx Daterangepicker Material
Pure Angular 2+ date range picker with material design theme, a demo here:
Stars: ✭ 169 (+25.19%)
Mutual labels:  directive, angular2
GuideChimp
Create interactive guided product tours in minutes with the most non-technical friendly, lightweight and extendable library.
Stars: ✭ 138 (+2.22%)
Mutual labels:  onboarding, tour
angular2-stretchy
angular2-stretchy is an Angular2 directive that automatically adjusts input width to fit content.
Stars: ✭ 12 (-91.11%)
Mutual labels:  angular2, directive
angular2-focus
Angular attribute directive that gives focus on an element depending on a given expression 🔎
Stars: ✭ 21 (-84.44%)
Mutual labels:  angular2, directive
Dejajs Components
Angular components
Stars: ✭ 37 (-72.59%)
Mutual labels:  demo, angular2
Eleme
restructure..
Stars: ✭ 1,635 (+1111.11%)
Mutual labels:  demo
Ng Pi Admin
Angular admin http://treesflower.com/ng-pi-admin
Stars: ✭ 131 (-2.96%)
Mutual labels:  angular2
Webpack Demo
webpack 4 config. demo ⚙️
Stars: ✭ 131 (-2.96%)
Mutual labels:  demo
Cicerone
🏛️ Give tours of your Shiny apps
Stars: ✭ 131 (-2.96%)
Mutual labels:  tour
Blazorchatsample
A sample Blazor chat application using SignalR
Stars: ✭ 134 (-0.74%)
Mutual labels:  demo
Swift project
原OC项目用swift实现,纯swift项目,可作为学习swift的demo,包含多个自定义控件,并且进行封装网络请求库,结构清晰。
Stars: ✭ 133 (-1.48%)
Mutual labels:  demo
Ciapre Xcode Theme
An easy on the eyes Xcode color scheme, ported from Ciapre Sublime Text.
Stars: ✭ 130 (-3.7%)
Mutual labels:  demo
Krakend Playground
Get started with KrakenD. A docker compose with KrakenD and a fake api to play with
Stars: ✭ 130 (-3.7%)
Mutual labels:  demo
Cute Deferred Shading
Cute little deferred shading implementation.
Stars: ✭ 129 (-4.44%)
Mutual labels:  demo

npm version Build Status codecov Cypress.io tests

Angular Joyride

An Angular Tour (Joyride) library built entirely in Angular, without using any heavy external dependencies like Bootstrap or JQuery. From now on you can easily guide your users through your site showing them all the sections and features.

For Angular 2+ (2 - 9)

Demo

See the demo. Let's take a tour! ✈️ 🌎

Install

npm install ngx-joyride --save

or

yarn add ngx-joyride

Usage

1. Mark your HTML elements with the joyrideStep directive

  <h1 joyrideStep="firstStep" title="Page Title" text="Main title!">Text</h1>
  <div joyrideStep="secondStep" title="Page Title" text="Main title!">Div content</div>

2. Import the JoyrideModule in your AppModule

@NgModule({
    declarations: [AppComponent],
    imports: [JoyrideModule.forRoot(), RouterModule.forRoot([]), BrowserModule],
    providers: [],
    bootstrap: [AppComponent]
})
export class AppModule {}

3. Inject the JoyrideService in your Component and start the Tour, passing the steps order list

@Component({
    selector: 'app-component',
    templateUrl: './app.component.html'
})
export class AppComponent {
    constructor(private readonly joyrideService: JoyrideService) {}

    onClick() {
        this.joyrideService.startTour(
            { steps: ['firstStep', 'secondStep'] } // Your steps order
        );
    }
}

4. En-joy 😉

API reference

Directive Inputs/Outputs

You can use the joyrideStep directive with these inputs:

@Input Required Purpose Values/Type
joyrideStep Yes The step name, it should be unique. string
stepPosition No The position in which the step will be drawn. 'top', 'right', 'bottom', 'left', 'center'
title No The step title. string
text No The step text content. string
stepContent No An Angular template with custom content. TemplateRef<any>
stepContentParams No Data object to pass in with Angular template Object
prevTemplate No An Angular template with a custom prev button. TemplateRef<any>
nextTemplate No An Angular template with a custom next button. TemplateRef<any>
doneTemplate No An Angular template with a custom done button. TemplateRef<any>
counterTemplate No An Angular template with a custom counter component. TemplateRef<any>
@Output Required Purpose
next No It fires an event when 'Next' button is clicked.
prev No It fires an event when 'Prev' button is clicked.
done No It fires an event when 'Done' button or 'Close' are clicked and the Tour is finished.

Options

Name Required Purpose Type Default value
steps Yes Represent the ordered list of steps name to show. e.g steps: ['step1', 'header', 'interesting-table', 'navbar']. This option is particularly useful for multi-pages navigation. If your step is not in the root path, you should indicate the route after the step name, with a @ as separator. E.g. : steps: ['firstStep', '[email protected]', '[email protected]/you', '[email protected]/details'] string[] none
startWith No The name of the step (plus the route for multi-page navigation) from which the stour should start. string undefined
waitingTime No The time (in milliseconds) to wait before showing the next/prev step. number 1
stepDefaultPosition No Define a step default position. The stepPositon set in the directive override this value. string bottom
themeColor No Backdrop, buttons and title color. (Hexadecimal value) string #3b5560
showCounter No Show the counter on the bottom-left. boolean true
showPrevButton No Show the "Prev" button. boolean true
logsEnabled No Enable logs to see info about the library status. Usuful to get a meaningful error message. boolean false
customTexts No Custom buttons text for next, prev, done buttons. Object { prev: 'prev', next: 'next', done: 'done'}

You can change each element step css overriding the default style.

How tos

Use Custom Content

If you'd like to use custom HTML content instead of simple text you can use the stepContent property instead of text. Let's see how.

<div joyrideStep="step1" [stepContent]="customContent">
    I'm the target element.
</div>
<ng-template #customContent>
    ... Insert whatever you'd like to ...
</ng-template>

Use Custom Content With Dynamic Data

If you'd like to pass params to template, use the stepContentParams property. Let's see how.

<div
    joyrideStep="step1"
    [stepContent]="customContent"
    [stepContentParams]="{'name': 'John'}"
>
    I'm the target element.
</div>
<ng-template #customContent let-person="name">
    Hello {{person}}
</ng-template>

Use custom buttons and/or counter

Custom buttons texts

If you'd like to customize the next, prev and done texts, you can use the customTexts option:

this.joyrideService.startTour({
  ...
  customTexts: {
    next: '>>',
    prev: '<<',
    done: 'Ok'
  }
});

Custom buttons templates

If you'd like to customize the next, prev and done button or you want to use your own counter component, you can:

Important: These inputs should be used just once, in the first step of your tour.

<div
    joyrideStep="step1"
    [prevTemplate]="prevButton"
    [nextTemplate]="nextButton"
    [doneTemplate]="doneButton"
    [counterTemplate]="counter"
>
    I'm the target element.
</div>
<ng-template #prevButton>
    <my-button>Go back!</my-button>
</ng-template>
<ng-template #nextButton>
    <my-button>Go ahead!</my-button>
</ng-template>
<ng-template #doneButton>
    <my-button>Complete</my-button>
</ng-template>
<ng-template #counter let-step="step" let-total="total">
    {{ step }} of {{ total }} steps
</ng-template>

N.B.: The counter template has 2 parameters, step represents the current step number, total is the total number of steps.

Set the options

this.joyrideService.startTour({
    steps: ['step1', '[email protected]', '[email protected]'],
    showPrevButton: false,
    stepDefaultPosition: 'top',
    themeColor: '#212f23'
});

Listen for events

Mode 1: Using directive output events

@Component({
    selector: 'app-component',
    template: `
        <div
            joyrideStep="joy1"
            title="title"
            (prev)="onPrev()"
            (next)="onNext()"
        >
            Hello!
        </div>
        <div joyrideStep="joy2" title="title2" (done)="onDone()">Hello!</div>
    `
})
export class AppComponent {
    constructor(private readonly joyrideService: JoyrideService) {}

    onClick() {
        this.joyrideService.startTour(
            { steps: ['joy1', 'joy2'] } // Your steps order
        );
    }

    onNext() {
        // Do something
    }

    onPrev() {
        // Do something
    }

    onDone() {
        // Do something
    }
}

Mode 2: Subscribing to startTour

@Component({
    selector: 'app-component',
    template: `
        <div
            joyrideStep="joy1"
            title="title"
            (prev)="onPrev()"
            (next)="onNext()"
        >
            Hello!
        </div>
        <div joyrideStep="joy2" title="title2" (done)="onDone()">Hello!</div>
    `
})
export class AppComponent {
    constructor(private readonly joyrideService: JoyrideService) {}

    onClick() {
        this.joyrideService.startTour({ steps: ['joy1', 'joy2'] }).subscribe(
            step => {
                /*Do something*/
            },
            error => {
                /*handle error*/
            },
            () => {
                /*Tour is finished here, do something*/
            }
        );
    }
}

N.B.: Using events is very helpful when your next target is hidden in the DOM. If a target is not visible (e.g. *ngIf='false') you should use the (next) event to make the target somehow findable in the DOM.

Get Multi Pages navigation

If your steps are scattered among different pages you can now reach them, just add their name in the steps list followed by @route/to/page.

Lets suppose you have three steps:

  • navbar, located in the app root /
  • user-avatar, located in /user/details
  • info, located in /about

What you should do is adding your steps in this way:

...
    this.joyrideService.startTour({steps: ["navbar", "[email protected]/details", "[email protected]"]);
...

NB: If you're using lazy modules, you should import the JoyrideModule in your AppModule using JoyrideModule.forRoot(). In your lazy loaded feature modules use JoyrideModule.forChild() instead.

Close programmatically the tour

In order to close programmatically the tour you'll just need to call the JoyrideService closeTour() method:

...
    this.joyrideService.closeTour();
...

Licence

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].