Coder Social home page Coder Social logo

alpine-tour's Introduction

This package only supports Alpine v3.x
This package needs TailwindCSS
This package currently does not work fantastic with the JIT compiler

Alpine Tour

Add a dynamic tour to your Alpine 3.x components with a custom directive.

About

This plugin adds a new x-tour to Alpine.

Installation

NPM

npm install @edsardio/alpine-tour

JS

Register your x-tour directive to Alpine.

import Alpine from "alpinejs";
import Tour from "@edsardio/alpine-tour";

Alpine.plugin(Tour);

window.Alpine = Alpine;
window.Alpine.start();

Usage

HTML

To create a tour add the directive to the element as following. The tour will be ordered by the step. Either bottom, top, left or right will let the directive know where to show the pop-up with the information.

<div x-data>     <!-- Note: the tour must be inside an element with x-data to be run -->
    <div x-tour.bottom="{step: 1, title: 'Example title', description: 'This is the description'}"></div>
    <div x-tour.top="{step: 2, title: 'Example title', description: 'This is the description'}"></div>
    <div x-tour.left="{step: 3, title: 'Example title', description: 'This is the description'}"></div>
    <div x-tour.right="{step: 4, title: 'Example title', description: 'This is the description'}"></div>
</div>

To start the tour add the following.

<button x-tour.start>Start tour</button>

The tour can be navigated using the left and right arrow key, and can be closed using the escape button (or the cross in the pop-up).

Translations

To overwrite the default texts in the tour you can do the following:

window.Alpine.store('tourtranslations', {
    previous: 'Vorige',
    next: 'Volgende',
    finish: 'Afronden'
});

alpine-tour's People

Contributors

boosh avatar edsardio avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.