Getting started

Installation

Manual

Download or source the javascript file and css file from unpkg

You can also download it directly from the releases listed in select-madu repository

<head>
  <script type="text/javascript" src="selectmadu.min.js"></script>
  <link rel="stylesheet" href="selectmadu.css">
</head>

NPM

You can install SelectMadu from npm using the following command.

npm install select-madu --save

and then import it in your javascript file

import SelectMadu from 'select-madu';

Note: CSS file has to be included separately

Basic usage

  import SelectMadu from 'select-madu';

  //To create
  let instance = new SelectMadu({
    //SelectMadu dom elements will be rendered within the specified parent element in target.
    target: document.querySelector("#parentElement"),

    //Properties for initializing SelectMadu. Refer Properties info below.
    props: {
      datasource: [
        { text: "Ferrai" }, 
        { text: "Lamborghini" },
        { text: "Aston Martin" }
      ]
    }
  });

  //To destroy and remove
  instance.$destroy();

Svelte

Optionally, if you are using Svelte you can import SelectMadu as a component.

import SelectMadu from 'select-madu';

<SelectMadu/>

Note: CSS file has to be included separately

Read more

Edit this page