seed-icons
v1.1.6
Published
An open-source icon set that makes tracking down and using optimized, quality, consistent brand SVG icons a little less painful.
Downloads
12
Readme
🌱 Seed icons
Seed icons is an open-source icon set that makes tracking down and using optimized, quality, consistent brand SVG icons a little less painful.
What's available?
Seed icons are available in a few different capacities:
SVG Library
Library of optimized SVG files for download on seedicons.com.
Figma Component Library
A consumable Figma component library for use in your designs. To use the components, log in to your Figma account and duplicate the file to your drafts.
Seed Repo
This repository that supplies a simplified API for use in your projects. SVGs can also be imported individually through the seed-icons/dist/icons/...
folder.
Quick start
CodeSandbox Template
View a live CodeSandbox example of fundamental HTML implementation.
HTML Snippet
<!DOCTYPE html>
<html>
<script src="https://unpkg.com/seed-icons"></script>
<body>
<i data-seed="google-plus"></i>
<i data-seed="github"></i>
<i data-seed="figma" height="60px" width="60px"></i>
<script>
seed.replace()
</script>
</body>
</html>
How to use
JavaScript
- Add a link to the icons library to your project using
unpkg
. After including the script,seed
will be available as a global variable.
<script src="https://unpkg.com/seed-icons"></script>
- Add the
data-seed
attribute with the icon name to an element in your HTML.
<i data-seed="figma"></i>
- Call
seed.replace()
method before the closing</body>
tag to replace all elements with thedata-seed
attribute with the corresponding SVG icon.
<script>
seed.replace()
</script>
Node
- Install
npm install seed-icons
- Import
import { ReactComponent as FirefoxIcon } from 'seed-icons/dist/icons/firefox.svg'
- Use
<FirefoxIcon />
API
1. seed.icons
An object with information about every icon. A typical icon object looks like:
seed.icons["google-play"]
// returns
{
name: 'google-play',
contents: '<path fill="#1ABCFE...',
tags: ['app', 'browser', 'google'],
attrs: {
class: 'seed seed-google-play',
xmlns: 'http://www.w3.org/2000/svg',
width: 48,
height: 48,
viewBox: '0 0 48 48',
}
}
2. seed.replace({attrs})
Replaces all elements that have a data-seed
attribute with SVG markup. You can pass seed.replace() an attrs object. All attributes on the placeholder element (i.e. <i>
) will be copied to the <svg>
tag. All attributes on the placeholder element (i.e. <i>
) will be copied to the <svg>
tag.
<!-- Pass the below attributes in the replace method. -->
<i data-seed="firefox"></i>
<script>
seed.replace({ class: 'foo', height: 40 })
</script>
--
<!-- Returns in this output: -->
<svg
xmlns="http://www.w3.org/2000/svg"
width="100px"
height="100px"
viewBox="0 0 48 48"
class="seed seed-figma foo"
data-seed="figma"
>
<path>...</path>
</svg>
3. seed.icons['name'].toSvg({attrs})
Returns the supplied icon name SVG as a string.
Bugs, Requests and Contributing
Contributions are always welcome. If you notice and bug or would like to request an icon, use an issue template to kickstart the process.
Credits
This project is one big mashup and open-source appropriation of projects from Feather, Ionicons, and Eva Icons. I started this project as something to work on while I practice React/Gatsby and inspecting those projects as I learn has been truly invaluable. Anything impressive is probably code from them I didn't change. Anything that barely functions is probably from yours truly. Please consider contributing.