🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

@fortawesome/fa-icon-chooser

Package Overview
Dependencies
Maintainers
7
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fortawesome/fa-icon-chooser

Font Awesome Icon Chooser

Source
npmnpm
Version
0.5.0
Version published
Maintainers
7
Created
Source

fa-icon-chooser web component

Usage

Add it to your JavaScript bundle:

npm install --save @fortawesome/fa-icon-chooser

After the resulting JavaScript bundle has been loaded in the DOM, you can mount an fa-icon-chooser in the DOM. Suppose your HTML has a container div:

<div id="fa-icon-chooser-container"></div>

Then you could write JavaScript like this:

function handleQuery(query) {
  // some function that handles queries
}

function getUrlText(url) {
  // some function that handles GET requests
}

function handleResult(event) {
  const result = event && event.detail;

  if (result) {
    console.log(`<i class"${result.prefix} ${result.iconName}">`);
  }
}

window.addEventListener('DOMContentLoaded', event => {
  const container = document.querySelector('#fa-icon-chooser-container');
  const el = document.createElement('fa-icon-chooser');
  el.handleQuery = handleQuery;
  el.getUrlText = getUrlText;
  el.addEventListener('finish', handleResult);
  container.appendChild(el);
});

See the fa-icon-chooser API Reference for details about what you'd need to implement in handleQuery(), getUrlText(), and handleResult().

You can also look at some example implementations in this repo's development runtime code.

FAQs

Package last updated on 14 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts