svelte-fa

Tiny FontAwesome 5 component for Svelte

Github stars Tracking Chart

svelte-fa

npm
bundle size
npm downloads
license

github
build
coverage

Tiny FontAwesome 5 component for Svelte.

  • FontAwesome svg icons
  • Tree-shakable, only import used icons
  • No CSS file required
  • FontAwesome duotone icons

Documents and examples.

Installation

npm install svelte-fa

Notice: For Sapper user, you have to install the component as a devDependency.

npm install svelte-fa -D

Usage

<script>
import Fa from 'svelte-fa'
import { faFlag } from '@fortawesome/free-solid-svg-icons'
</script>

<Fa icon={faFlag}/>

Properties

<Fa
  icon={faFlag}
  fw
  flip="horizontal"
  pull="left"
  rotate={90}
  size="2x"
  color="#ff0000"/>
  • fw: fixed width
  • flip: string values horizontal, vertical, both
  • pull: string values left, right
  • rotate: number or string values 90, 180, 270, 30, -30 ...
  • size: string values xs, sm, lg or 2x, 3x, 4x ...
  • color: icon color, default currentColor

Duotone Icons

<script>
import Fa from 'svelte-fa'
import { faFlag } from '@fortawesome/pro-duotone-svg-icons'
</script>

<Fa
  icon={faFlag}
  primaryColor="red"
  secondaryColor="#000000"
  primaryOpacity={0.8}
  secondaryOpacity={0.6}
  swapOpacity/>

Duotone Icons Theme

<script>
import Fa from 'svelte-fa'
import { faFlag } from '@fortawesome/pro-duotone-svg-icons'

const theme = {
  primaryColor: 'red',
  secondaryColor: '#000000',
  primaryOpacity: 0.8,
  secondaryOpacity: 0.6,
}
</script>

<Fa
  icon={faFlag}
  {...theme}/>

Main metrics

Overview
Name With OwnerCweili/svelte-fa
Primary LanguageSvelte
Program languageJavaScript (Language Count: 5)
Platform
License:MIT License
所有者活动
Created At2019-06-07 05:12:11
Pushed At2025-06-24 00:41:35
Last Commit At2025-05-26 21:40:32
Release Count24
Last Release Namev4.0.4 (Posted on 2025-04-22 15:05:47)
First Release Namev1.0.0 (Posted on 2019-06-07 17:33:15)
用户参与
Stargazers Count401
Watchers Count6
Fork Count26
Commits Count277
Has Issues Enabled
Issues Count63
Issue Open Count4
Pull Requests Count76
Pull Requests Open Count10
Pull Requests Close Count250
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private