fontAwesome 图标

Get vector icons and social logos on your website with Font Awesome

react

依赖包

1
yarn add @fortawesome/fontawesome-svg-core @fortawesome/free-solid-svg-icons @fortawesome/react-fontawesome

引入依赖

1
2
3
4
5
import { library } from '@fortawesome/fontawesome-svg-core'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faStroopwafel } from '@fortawesome/free-solid-svg-icons'

library.add(faStroopwafel)

使用

1
2
3
<div>
Favorite Food: <FontAwesomeIcon icon="stroopwafel" />
</div>

如果使用trash 图标,则需要将引入更改为faTrash

图标库