wc-fontawesome

Webcomponent for FontAwesome icon definitions

Downloads
1.5K
Stars
1
Committers
4

@riovir/wc-fontawesome Storybook

Non-official webcomponents for Font Awesome.

The API and usage is based on vue-fontawesome.

Installation

# Install peer dependency
$ npm i --save @fortawesome/fontawesome-svg-core
# Install the components
$ npm i --save @riovir/wc-fontawesome
# Install a Font Awesome format icon pack
$ npm i --save @fortawesome/free-solid-svg-icons

Features

Register your components first

import { FontAwesomeIcon } from '@riovir/wc-fontawesome'
customElements.define('font-awesome-icon', FontAwesomeIcon);
// Alternatively, use a shorter name
customElements.define('fa-icon', FontAwesomeIcon);

For examples see the Storybook. While the code samples use lit-html syntax, this package does not require it.

Why not self-define by default?

In the event you need to share the page with other teams using different versions of this component, you'll need some sort of scoping. You can read more about the topic on open-wc.org.