Skip to content

It makes it very simple to use SVG icons in your Svelte projects.

License

Notifications You must be signed in to change notification settings

aykutkardas/svelte-icomoon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Svelte-Icomoon Logo

npm License

It makes it very simple to use SVG icons in your Svelte projects.

Install

npm install svelte-icomoon
yarn add svelte-icomoon

Usage

You can use svgps.app to access over 40,000 free icons and convert your own icons into selection.json.

Or you can use IcoMoon to generate the selection.json file.

Declare

// Icon.svelte
<script>
  import Icomoon from "svelte-icomoon";
  import iconSet from "./selection.json";
</script>

<Icomoon iconSet="{iconSet}" {...$$props} />

Use

<script>
  import Icon from "./Icon.svelte";
</script>

<Icon name="pencil" size="{30}" color="blue" />

Props List

Name Type Default Sample
iconSet Object - "selection.json file content"
name String - "home"
size Number,String - "1em", 10, "100px"
color String - "red", "#f00", "rgb(0,0,0)"
style Object {...} { color: '#ff0'}
title String - "Icon Title"
disableFill Boolean - true
removeInlineStyle Boolean - true

Default Style

{
  display: "inline-block",
  stroke: "currentColor",
  fill: "currentColor",
}

Related Links

About

It makes it very simple to use SVG icons in your Svelte projects.

Resources

License

Stars

Watchers

Forks