npm: possibly marvellous

    @pluginjs/choice

    0.8.14 • Public • Published

    Choice

    npm package

    A flexible modern choice js plugin.

    Samples

    Introduction

    Installation

    Yarn

    yarn add @pluginjs/choice

    NPM

    npm i @pluginjs/choice

    Getting Started

    CDN:

    Development:

    <script src="https://unpkg.com/@pluginjs/choice/dist/choice.js"></script>
    <link rel="stylesheet" href="https://unpkg.com/@pluginjs/choice/dist/choice.css">

    Production:

    <script src="https://unpkg.com/@pluginjs/choice/dist/choice.min.js"></script>
    <link rel="stylesheet" href="https://unpkg.com/@pluginjs/choice/dist/choice.min.css">

    Initialize

    HTML:

    <div class="element"></div>

    ECMAScript Module:

    import Choice from "@pluginjs/choice"
    import "@pluginjs/choice/dist/choice.css"
    
    Choice.of(document.querySelector('.element'), options)

    CommonJS:

    require("@pluginjs/choice/dist/choice.css")
    const Choice = require("@pluginjs/choice")
    
    Choice.of(document.querySelector('.element'), options)

    Browser:

    <link rel="stylesheet" href="https://unpkg.com/@pluginjs/choice/dist/choice.css">
    <script src="https://unpkg.com/@pluginjs/choice/dist/choice.js"></script>
    <script>
      Pj.choice('.element', options)
    </script>

    API

    Options

    Options are called on choice instances through the choice options itself. You can also save the instances to variable for further use.

    Name Description Default
    "theme" Set plugin theme option null
    "multiple" Set multiple false
    "value" Set vakue ``
    "overflow" Set overflow false
    "disabled" Disabled plugin false
    "toggleTrigger" Set toggleTrigger hover
    "toggleIcon" Set toggleIcon fa fa-caret-down
    "templates" Set default templates {}

    Events

    Events are called on choice instances through the choice events itself. You can also save the instances to variable for further use.

    Name Description
    "ready" Gets fired when plugin has ready
    "enable" Gets fired when plugin has enabled
    "disable" Gets fired when plugin has disabled
    "destroy" Gets fired when plugin has destroy
    "change" Gets fired when plugin has changed
    "select" Gets fired when plugin has select
    "unselect" Gets fired when plugin has unselect

    Methods

    Methods are called on choice instances through the choice method itself. You can also save the instances to variable for further use.

    Name Description
    "enable" Enabled plugin if plugin is disabled
    "disable" Disable plugin
    "destroy" Destroy plugin
    "select" Set value of select
    "unselect" Set value of unselect
    "get" Get value by key
    "set" Set value by key
    "val" Set or get value by key

    Classes

    Name | Description | Default --|| "NAMESPACE" | Declare plugin namespace | pj-choice "THEME" | Declare plugin theme | {namespace}--{theme} "WRAP" | Declare plugin wrap | {namespace} "ITEM" | Declare plugin item | {namespace}-item "DROPDOWN" | Declare dropdown scope | {namespace}-dropdown "DROPDOWNSHOW" | Declare plugin dropdown show | {namespace}-dropdown-show "TOGGLE" | Declare plugin toggle | {namespace}-toggle "SELECTED" | Declare plugin selected | {namespace}-selected "DISABLED" | Announce plugin is disabled | {namespace}-disabled

    Browser support

    Tested on all major browsers.

    IE / EdgeIE / Edge FirefoxFirefox ChromeChrome SafariSafari OperaOpera
    IE11, Edge last 2 versions last 2 versions last 2 versions last 2 versions

    License

    @pluginjs/choice is Licensed under the GPL-v3 license.

    If you want to use @pluginjs/choice project to develop commercial sites, themes, projects, and applications, the Commercial license is the appropriate license. With this option, your source code is kept proprietary.

    For purchase an Commercial License, contact us purchase@thecreation.co.

    Copyright

    Copyright (C) 2022 Creation Studio Limited.

    Keywords

    none

    Install

    npm i @pluginjs/choice

    Homepage

    pluginjs.com

    DownloadsWeekly Downloads

    3

    Version

    0.8.14

    License

    GPL-3.0

    Unpacked Size

    147 kB

    Total Files

    14

    Last publish

    Collaborators

    • thecreation
    • kaptinlin