JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 308
  • Score
    100M100P100Q86297F
  • License MIT

Icon picker - Vanilla JS icon picker

Package Exports

  • vanilla-icon-picker

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vanilla-icon-picker) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Vanilla icon picker

GitHub package.json version GitHub

Icons includes:

  • Font Awesome 5

Getting started

Node

Install via npm or yarn

// NPM
npm i vanilla-icon-picker

// YARN
yarn add vanilla-icon-picker
// One of the following themes
import 'vanilla-icon-picker/dist/themes/default.min.css'; // 'default' theme
import 'vanilla-icon-picker/dist/themes/bootstrap-5.min.css'; // 'bootstrap-5' theme

import IconPicker from 'vanilla-icon-picker';

⚠️ Attention: Don't forget to add font-awesome to preview the icons package and if you use bootstrap theme dont forget to include bootstrap 5 css.

Usage

const iconPicker = new IconPicker('input', {
    // Options
});

Live demo →

Options

{
    // Change icon picker's theme
    theme: 'default',

        // Close icon picker modal when icon is selected
        // If is `false` save button appear
        closeOnSelect
:
    true,

        // Translatable text
        i18n
:
    {
        'input:placeholder'
    :
        'Search icon…',

            'text:title'
    :
        'Select icon',
            'text:empty'
    :
        'No results found…',

            'btn:save'
    :
        'Save'
    }

Events

Use the on(event, callback) and off(event, callback) functions to bind / unbind eventlistener.

Event Description Arguments
init Initialization done IconPickerInstance
select Icon is selected, return icon name string
save Fired when saved with button or if closeOnSelect option is true, return icon name string
show Modal is shown IconPickerInstance
hide Modal picker is hidden IconPickerInstance
iconPicker.on('init', instance => {
    console.log('Init:', instance);
});

Licence

MIT Licence