Skip to content

A simple, intuitive icon picker for Font-aesome Icons, perfect for quick integration and effortless customization.

Notifications You must be signed in to change notification settings

shakilahmed0369/ez-fontawesome-Icon-picker

Repository files navigation

EZ Fontawesome Icon Picker

A flexible, easy-to-use icon picker for Fontawesome Icons.

Description of image

Installation

Setup is straightforward:

  1. Add Fontawesome Icons to your project.
  2. Add EZ Icon Picker to your project.
  3. Initialize EZ Icon Picker.

Add the Required Files

Include the following links in your HTML file to load Fontawesome Icons and EZ Icon Picker:

<!-- EZ Icon Picker CSS -->
<link rel="stylesheet" href="/dist/ez-icon-picker.css">

<!-- Fontawesome JavaScript -->
<script src="https://kit.fontawesome.com/38f33a5e76.js" crossorigin="anonymous"></script>
<!-- EZ Icon Picker JavaScript -->
<script src="/dist/ez-icon-picker.min.js" type="module"></script>

Setup the Icon Picker

1.Add a div with a selector class, e.g., .icon-picker.

<div class="icon-picker" data-name="icon"></div>

2.Initialize the picker by adding the following JavaScript:

<script>
    document.addEventListener('DOMContentLoaded', () => {
        new EzIconPicker({
            selector: '.icon-picker'
        });
    });
</script>

Full Example Code

Here’s the complete HTML setup for the EZ Fontawesome Icon Picker:

<!DOCTYPE html>
<html lang="en">
<head>
    <!-- EZ Icon Picker CSS -->
    <link rel="stylesheet" href="/dist/ez-icon-picker.css">
    <title>Tabler Icon Picker</title>
</head>
<body>
    <!-- Icon Picker Element -->
    <div class="icon-picker" data-name="icon" data-icon="ti ti-home"></div>

    <!-- Fontawesome JavaScript -->
    <script src="https://kit.fontawesome.com/38f33a5e76.js" crossorigin="anonymous"></script>

    <!-- EZ Icon Picker JavaScript -->
    <script src="/dist/ez-icon-picker.min.js" type="module"></script>

    <script>
        document.addEventListener('DOMContentLoaded', () => {
            new EzIconPicker({
                selector: '.icon-picker'
            });
        });
    </script>
</body>
</html>

Properties

data-name - Specifies the name of the input field, useful for form submissions.

data-icon - Allows pre-selecting an icon by specifying its class name

Example Usage

To create an icon picker with a default icon, use the following code:

<div class="icon-picker" data-name="icon" data-icon="ti ti-home"></div>

About

A simple, intuitive icon picker for Font-aesome Icons, perfect for quick integration and effortless customization.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published