Themeable Icon Picker In Vanilla JavaScript
1. Load the main script icon-picker.min.js at the end of the document.
<script src="dist/icon-picker.min.js"></script>
2. Load a theme of your choice in the document. The library currently comes with 2 themes:
<!-- Default Theme --> <link rel="stylesheet" href="dist/themes/default.min.css">
<!-- Bootstrap 5 Theme (Requires Bootstrap 5 Stylesheet) --> <link rel="stylesheet" href="/path/to/cdn/bootstrap.min.css" /> <link rel="stylesheet" href="dist/themes/bootstrap-5.min.css">
3. Attach the icon picker to a trigger element like input or button.
<input type="text" id="icon-picker">
const iconPickerDemo = new IconPicker('input', {
// options here
}); 4. Set the theme of the icon picker.
const iconPickerDemo = new IconPicker('input', {
theme: 'bootstrap-5',
}); 5. Determine whether to close the icon picker after an icon has been selected. Default: true.
const iconPickerDemo = new IconPicker('input', {
closeOnSelect: false,
}); 6. Add more icon libraries to the icon picker. ‘FontAwesome Brands 5’ | ‘FontAwesome Solid 5’ | ‘FontAwesome Regular 5’ | ‘Material Design Icons’ | ‘Iconoir’, or a custom JSON path.
const iconPickerDemo = new IconPicker('input', {
iconSource: [],
}); const iconPickerDemo = new IconPicker('input', {
iconSource: [
{
key: 'academicons',
prefix: 'ai ai-',
url: 'https://raw.githubusercontent.com/iconify/icon-sets/master/json/academicons.json'
}],
}); 7. API methods.
// open the icon picker iconPickerDemo.open(); // close the icon picker iconPickerDemo.hide(); // clear the icon iconPickerDemo.clear(); // check if the icon picker is opened iconPickerDemo.isOpen(); // check if the icons are loaded iconPickerDemo.iconsLoaded(); // destroy the instance iconPickerDemo.destroy(deleteInstance);
8. Event handlers.
iconPickerDemo.on('select', (icon) => {
// do something
});
iconPickerDemo.on('save', (icon) => {
// do something
});
iconPickerDemo.on('clear', (icon) => {
// do something
});
iconPickerDemo.on('show', instance => {
// do something
});
iconPickerDemo.on('hide', instance => {
// do something
}); v1.4.2 (11/04/2025)
v1.4.1 (05/19/2025)
v1.3.1 (08/09/2024)
v1.3.0 (02/21/2024)
v1.2.1 (10/03/2023)
v1.2.0 (07/22/2023)
v1.1.3 (04/01/2022)
v1.1.2 (03/31/2022)
v1.1.0 (03/11/2022)
v1.0.0 (11/18/2021)
11/15/2021
The post Themeable Icon Picker In Vanilla JavaScript appeared first on CSS Script.
May 10, 2026 Imagine if the biggest, most influential businesses in this country came together…
Crimson Desert developer Pearl Abyss has released this week’s update as promised, and it adds…
It took nearly 50 years. WKRP in Cincinnati is no longer just a TV sitcom.…
The Mountain Home Area Chamber of Commerce hosted its 2026 Four-Person Scramble Golf Tournament Friday…
Growing up and spending all of his 44-years in Lead Hill and living on the…
Mountain Home Mayor Hillrey Adams says work is continuing at a rapid pace as the…
This website uses cookies.