项目作者: yukipastelcat

项目描述 :
@fortawesome/vue-fontawesome implementation for Svelte
高级语言: JavaScript
项目地址: git://github.com/yukipastelcat/svelte-fontawesome.git
创建时间: 2020-01-10T09:47:07Z
项目社区:https://github.com/yukipastelcat/svelte-fontawesome

开源协议:MIT License

下载


fontawesome-svelte

npm
npm bundle size
GitHub Workflow Status (branch)
GitHub Workflow Status (branch)

Introduction

This package is for integrating FontAwesome with Svelte.
Inspired by vue-fontawesome.

Under the hood this package uses @fortawesome/fontawesome-svg-core library. You can find API docs here.

Usage

This package relies on @fortawesome/fontawesome-svg-core"">@fortawesome/fontawesome-svg-core.

Maybe you’re looking for “Add more styles or Pro icons”.

Keep in mind that using Pro packages requires additional configuration.

  1. <script>
  2. import { library } from '@fortawesome/fontawesome-svg-core';
  3. import { faSmileWink as fasSmileWink } from '@fortawesome/free-solid-svg-icons';
  4. import { FontAwesomeIcon, FontAwesomeLayers, FontAwesomeLayersText } from 'fontawesome-svelte';
  5. library.add(fasSmileWink);
  6. </script>
  7. <FontAwesomeIcon icon={fasSmileWink} ></FontAwesomeIcon>
  8. <FontAwesomeIcon icon={['fas', 'smile-wink']} ></FontAwesomeIcon>
  9. <!-- The solid style is implicit -->
  10. <FontAwesomeIcon icon="smile-wink" ></FontAwesomeIcon>

Features

Basic

Size

  1. <FontAwesomeIcon icon={['fas', 'smile-wink']} size="xs" ></FontAwesomeIcon>
  2. <FontAwesomeIcon icon={['fas', 'smile-wink']} size="lg" ></FontAwesomeIcon>
  3. <FontAwesomeIcon icon={['fas', 'smile-wink']} size="6x" ></FontAwesomeIcon>

Fixed width

  1. <FontAwesomeIcon icon={['fas', 'smile-wink']} fixedWidth={true} ></FontAwesomeIcon>

Rotate

  1. <FontAwesomeIcon icon={['fas', 'smile-wink']} rotation={180} ></FontAwesomeIcon>

Flip

  1. <FontAwesomeIcon icon={['fas', 'smile-wink']} flip="horizontal" ></FontAwesomeIcon>
  1. <FontAwesomeIcon icon={['fas', 'smile-wink']} flip="vertical" ></FontAwesomeIcon>
  1. <FontAwesomeIcon icon={['fas', 'smile-wink']} flip="both" ></FontAwesomeIcon>

Spin and pulse animation

  1. <FontAwesomeIcon icon={['fas', 'smile-wink']} spin={true} ></FontAwesomeIcon>
  1. <FontAwesomeIcon icon={['fas', 'smile-wink']} pulse={true} ></FontAwesomeIcon>

Border

  1. <FontAwesomeIcon icon={['fas', 'smile-wink']} border={true} ></FontAwesomeIcon>

Pull left or right

  1. <FontAwesomeIcon icon={['fas', 'smile-wink']} pull="left" ></FontAwesomeIcon>
  2. <FontAwesomeIcon icon={['fas', 'smile-wink']} pull="right" ></FontAwesomeIcon>

Invert

  1. <FontAwesomeIcon icon={['fas', 'smile-wink']} inverse={true} ></FontAwesomeIcon>

Swap opacity

  1. <FontAwesomeIcon icon={['fas', 'smile-wink']} swapOpacity={true} ></FontAwesomeIcon>

Advanced

Power transforms

  1. <FontAwesomeIcon icon={['fas', 'smile-wink']} transform="shrink-6 left-4" ></FontAwesomeIcon>
  2. <FontAwesomeIcon icon={['fas', 'smile-wink']} transform={ { rotate: 45 } } ></FontAwesomeIcon>

Masking

  1. <FontAwesomeIcon icon={['fas', 'pencil-alt']} mask={['fas', 'comment']} transform="shrink-10 up-.5" ></FontAwesomeIcon>
  2. <FontAwesomeIcon icon={fasPencilAlt} mask={fasComment} transform="shrink-10 up-.5">

Symbols

  1. <FontAwesomeIcon icon={['fas', 'pencil-alt']} symbol={true} ></FontAwesomeIcon>
  2. <FontAwesomeIcon icon={['fas', 'pencil-alt']} symbol="pencil-alt" ></FontAwesomeIcon>

Layers

  1. <FontAwesomeLayers class="fa-6x">
  2. <FontAwesomeIcon icon={['fas', 'circle']} style="color: tomato" ></FontAwesomeIcon>
  3. <FontAwesomeIcon icon={['fas', 'times']} transform="shrink-6" inverse={true} ></FontAwesomeIcon>
  4. </FontAwesomeLayers>
  5. <FontAwesomeLayers class="fa-6x">
  6. <FontAwesomeIcon icon={['fas', 'certificate']} ></FontAwesomeIcon>
  7. <FontAwesomeLayersText class="fa-inverse" transform="shrink-11.5 rotate--30" style="font-weight: 900; font-family: sans-serif;" value="NEW" ></FontAwesomeLayersText>
  8. </FontAwesomeLayers>
  9. <FontAwesomeLayers class="fa-6x">
  10. <FontAwesomeIcon icon={['fas', 'envelope']} ></FontAwesomeIcon>
  11. <FontAwesomeLayersText counter={true} style="background: tomato; font-family: sans-serif;" value="1,419" ></FontAwesomeLayersText>
  12. </FontAwesomeLayers>