1.0.6 • Published 21 days ago

coulisse v1.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
21 days ago

Coulisse

Create a mobile menu effortlessly with Coulisse, a lightweight Alpine.js plugin. Display your menu anywhere in your code where you want the mobile menu to appear. Coulisse transforms an array of settings and data into a responsive mobile menu, providing seamless navigation for your web application.

Installation

To install Coulisse, you can use npm:

npm install coulisse

Setup

You'll need to init Coulisse after the import of Alpinejs & before Alpine.start() like so:

import Alpine from 'alpinejs'

//...

initCoulisse(settings, items)

//...

Alpine.start()

settings: which act globally

settingsdefault valueinfos
backgroundColor'#ffffff'any color string
fontSize'1rem'16px, 0.8rem, ...
iconScale1size multiplier, 1 = 100%, 1.2 = 120%
useGPUfalseboolean

items: which will be your mobile menu. Items is an array of object, that can carry inside of himself another Items, recursivly. here goes the following structure:

const items = [
    {
        label: string,
        icon: string, // optional
        // choose between link or items
        link: string,
        items: [
            // same structure as main items
            {
                label: string,
                icon: string, // optional
                class: string, // optional
                // choose between link or items
                link: string,
                items: [
                    // ...
                ]
            }
        ],
    }
]
itemstypeinfos
labelstringrequired
linkstringcan't be use with items
iconstringoptional
itemsfalsecan't be use with link
classstringoptional

Usage

Warning: you'll need a x-data attached on it, or above

<body>
    <!-- Place thing wherever you want your menu to be -->
    <div x-coulisse></div>

    <!-- Toggle menu -->
    <div x-coulisse-toggle>Show/Hide</div>
</body>

You can use $store.coulisse.showMenu to dislay different text based on menu's state

    <div x-data x-coulisse-toggle x-text="$store.coulisse.showMenu ? 'Close' : 'Open'"></div>
1.0.6

21 days ago

1.0.5

21 days ago

1.0.4

21 days ago

1.0.3

26 days ago

1.0.2

3 months ago

1.0.1

3 months ago

1.0.0

3 months ago