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.
![]()
Integrate Simple Fontawesome Icon Picker
Libraries
Include all the required libraries on page like jQuery, bootstrap, fontawesome and plugin’s library
HTML
Create an sample input fields for the fontawesome 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, // Popover title (optional) only if specified in the template
selected: false, // use this value as the current item and ignore the original
defaultValue: false, // use this value as the current item if input or element value is empty
placement: 'bottom', // (has some issues with auto and CSS). auto, top, bottom, left, right
collision: 'none', // If true, the popover will be repositioned to another position when collapses with the window borders
animation: true, // fade in/out on show/hide ?
//hide iconpicker automatically when a value is picked. it is ignored if mustAccept is not false and the accept button is visible
hideOnSelect: false,
showFooter: false,
searchInFooter: false, // If true, the search will be added to the footer instead of the title
mustAccept: false, // only applicable when there's an iconpicker-btn-accept button in the popover footer
selectedCustomClass: 'bg-primary', // Appends this class when to the selected item
icons: [], // list of icon objects [{title:String, searchTerms:String}]. By default, all Font Awesome icons are included.
fullClassFormatter: function(val) {
return 'fa ' + val;
},
input: 'input,.iconpicker-input', // children input selector
inputSearch: false, // use the input as a search box too?
container: false, // Appends the popover to a specific element. If not set, the selected element or element parent is used
component: '.input-group-addon,.iconpicker-component', // children component jQuery selector or object, relative to the container element
// Plugin templates:
templates: {
popover: '' +
'',
footer: '',
buttons: '' +
' ',
search: '',
iconpicker: '',
iconpickerItem: ''
});
});
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.