|
|
2 年之前 | |
|---|---|---|
| .. | ||
| dist | 2 年之前 | |
| src | 2 年之前 | |
| .browserslistrc | 2 年之前 | |
| .eslintrc.js | 2 年之前 | |
| LICENSE | 2 年之前 | |
| README.md | 2 年之前 | |
| babel.config.js | 2 年之前 | |
| jest.config.js | 2 年之前 | |
Tiny FontAwesome 5 component for Svelte.
npm install svelte-fa
Install FontAwesome icons via official packages, for example:
npm install @fortawesome/free-solid-svg-icons
Notice for Sapper user: You may need to install the component as a devDependency:
npm install svelte-fa -D
Notice for Svelte Kit user: You may need to import the component explicitly as below:
import Fa from 'svelte-fa/src/fa.svelte'
<script>
import Fa from 'svelte-fa'
import { faFlag } from '@fortawesome/free-solid-svg-icons'
</script>
<Fa icon={faFlag} />
Fa Properties<Fa
icon={faFlag}
size="2x"
color="#ff0000"
fw
pull="left"
scale={1.2}
translateX={0.2}
translateY={0.2}
rotate={90}
flip="horizontal"
spin
pulse
/>
icon: icon from FontAwesome packages, for example: @fortawesome/free-solid-svg-iconssize: string values xs, sm, lg or 2x, 3x, 4x, ..., 10xcolor: string icon color, default currentColorfw: boolean fixed widthpull: string values left, rightscale: number | string transform scale, unit is em, default 1translateX: number | string transform position X, unit is em, default 0translateY: number | string transform position Y, unit is em, default 0flip: string values horizontal, vertical, bothrotate: number | string values 90, 180, 270, 30, -30 ...spin: boolean spin iconspulse: boolean pulse spin iconsimport Fa, {
FaLayers,
FaLayersText,
} from 'svelte-fa';
<FaLayers
size="4x"
pull="left"
>
<Fa icon={faCertificate} />
<FaLayersText
scale={0.25}
rotate={-30}
color="white"
style="font-weight: 900"
>
NEW
</FaLayersText>
</FaLayers>
FaLayers Propertiessize: string values xs, sm, lg or 2x, 3x, 4x, ..., 10xpull: string values left, rightFaLayersText Propertiessize: string values xs, sm, lg or 2x, 3x, 4x, ..., 10xcolor: string icon color, default currentColorscale: number | string transform scale, unit is em, default 1translateX: number | string transform position X, unit is em, default 0translateY: number | string transform position Y, unit is em, default 0flip: string values horizontal, vertical, bothrotate: number | string values 90, 180, 270, 30, -30 ...<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
/>
<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}
/>