Integrate Simple Fontawesome Icon Picker using fontawesome-iconpicker jQuery Plugin

Integrate Simple Fontawesome Icon Picker using fontawesome-iconpicker jQuery Plugin
Few days back i shared tutorial about how to integrate bootstrap icon picker on website, Today I am going to share a simple jQuery plugin to add fontawesome icon picker on your website. As we know fontawesome is very popular library for icons you must have use this library on many of your projects. But if you want to dynamical add fontawesome icon with any menu, tabs or any other dynamic stuff which required fonts then you can use this cool icon picker plugin.

Fontawesome Icon Picker



Integrate Simple Fontawesome Icon Picker

Libraries

Include all the required libraries on page like jQuery, bootstrap, fontawesome and plugin’s library

<!--CSS-->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link href="https://use.fontawesome.com/releases/v5.0.8/css/all.css" rel="stylesheet">
<link href="fontawesome-iconpicker.min.css" rel="stylesheet">
 
<!--JS-->
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="fontawesome-iconpicker.min.js"></script>

HTML

Create an sample input fields for the fontawesome icon picker.

<input type="text" class="icon-picker" />
      <br/>
       <input type="text" class="icon-picker" />
      <br/>
       <input type="text" class="icon-picker" />

JS

Now use following one line of javascript to activate default fontawesome icon picker on input fields.

$(function() {   
   $('.icon-picker').iconpicker();
 });




Here is the list of options you can use in above function to customize your fontawesome iconpicker.

$(function() {   
   $('.icon-picker').iconpicker({
    title: false, 
    selected: false, 
    defaultValue: false, 
    placement: 'bottom', 
    collision: 'none', 
    animation: true, 
    
    hideOnSelect: false,
    showFooter: false,
    searchInFooter: false, 
    mustAccept: false, 
    selectedCustomClass: 'bg-primary', 
    icons: [], 
    fullClassFormatter: function(val) {
        return 'fa ' + val;
    },
    input: 'input,.iconpicker-input', 
    inputSearch: false, 
    container: false, 
    component: '.input-group-addon,.iconpicker-component', 
    
    templates: {
        popover: '<div class="iconpicker-popover popover"><div class="arrow"></div>' +
            '<div class="popover-title"></div><div class="popover-content"></div></div>',
        footer: '<div class="popover-footer"></div>',
        buttons: '<button class="iconpicker-btn iconpicker-btn-cancel btn btn-default btn-sm">Cancel</button>' +
            ' <button class="iconpicker-btn iconpicker-btn-accept btn btn-primary btn-sm">Accept</button>',
        search: '<input type="search" class="form-control iconpicker-search" placeholder="Type to filter" />',
        iconpicker: '<div class="iconpicker"><div class="iconpicker-items"></div></div>',
        iconpickerItem: '<a role="button" href="#" class="iconpicker-item"><i></i></a>'
    });
 });

See live demo and download source code.

DEMO | DOWNLOAD

Visit official github repository for more information and follow for future updates. Don’t forget to read license for using this plugin in your projects.