Repository: feathericons/feather
Branch: main
Commit: 3dc050d97405
Files: 56
Total size: 63.7 KB
Directory structure:
gitextract_6lb9fqmi/
├── .babelrc
├── .changeset/
│ ├── README.md
│ └── config.json
├── .eslintignore
├── .eslintrc.js
├── .github/
│ ├── CODEOWNERS
│ ├── ISSUE_TEMPLATE/
│ │ ├── 01-icon-request.yml
│ │ └── 02-bug-report.yml
│ └── workflows/
│ ├── ci.yml
│ └── release.yml
├── .gitignore
├── .lintstagedrc
├── .prettierignore
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── bin/
│ ├── .eslintrc.json
│ ├── __tests__/
│ │ ├── __snapshots__/
│ │ │ ├── build-icons-object.test.js.snap
│ │ │ ├── build-sprite-string.test.js.snap
│ │ │ └── optimize-svg.test.js.snap
│ │ ├── build-icons-object.test.js
│ │ ├── build-sprite-string.test.js
│ │ └── optimize-svg.test.js
│ ├── build-icons-json.js
│ ├── build-icons-object.js
│ ├── build-sprite-string.js
│ ├── build-sprite.js
│ ├── build-svgs.js
│ ├── build.sh
│ ├── optimize-svg.js
│ ├── optimize-svgs.js
│ └── setup.sh
├── commitlint.config.js
├── examples/
│ └── index.html
├── package.json
├── src/
│ ├── __tests__/
│ │ ├── __snapshots__/
│ │ │ ├── icon.test.js.snap
│ │ │ ├── icons.test.js.snap
│ │ │ ├── replace.node.test.js.snap
│ │ │ ├── replace.test.js.snap
│ │ │ └── to-svg.test.js.snap
│ │ ├── icon.test.js
│ │ ├── icons.test.js
│ │ ├── index.test.js
│ │ ├── replace.node.test.js
│ │ ├── replace.test.js
│ │ └── to-svg.test.js
│ ├── default-attrs.json
│ ├── icon.js
│ ├── icons.js
│ ├── index.js
│ ├── replace.js
│ ├── tags.json
│ └── to-svg.js
└── webpack.config.js
================================================
FILE CONTENTS
================================================
================================================
FILE: .babelrc
================================================
{
"presets": [
[
"env",
{
"targets": {
"browsers": ["last 2 versions"]
}
}
],
"stage-2"
]
}
================================================
FILE: .changeset/README.md
================================================
# Changesets
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works with mono-repos or single package repos to help you version and release your code. You can find the full documentation for it [in our repository](https://github.com/changesets/changesets)
We have a quick list of common questions to get you started engaging with this project in [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
================================================
FILE: .changeset/config.json
================================================
{
"$schema": "https://unpkg.com/@changesets/config@2.3.1/schema.json",
"changelog": [
"@changesets/changelog-github",
{ "repo": "feathericons/feather" }
],
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
================================================
FILE: .eslintignore
================================================
dist
coverage
================================================
FILE: .eslintrc.js
================================================
module.exports = {
env: {
browser: true,
es2021: true,
node: true,
},
extends: 'eslint:recommended',
overrides: [
{
env: {
node: true,
},
files: ['.eslintrc.{js,cjs}'],
parserOptions: {
sourceType: 'script',
},
},
],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
rules: {},
};
================================================
FILE: .github/CODEOWNERS
================================================
* @colebemis
================================================
FILE: .github/ISSUE_TEMPLATE/01-icon-request.yml
================================================
name: 🙏 Icon request
description: Request a new icon
title: 'Icon request: '
labels: ['icon request']
projects: ['feathericons/1']
body:
- type: input
id: icon-name
attributes:
label: Icon name
placeholder: e.g. star
validations:
required: true
- type: textarea
id: use-case
attributes:
label: Use case
description: Please describe your use case for the requested icon.
placeholder: e.g. I need a star icon to use in my rating system.
validations:
required: true
- type: textarea
id: screenshots
attributes:
label: Screenshots of similar icons
description: Please attach screenshots of similar icons from other icon sets to help us visualize your request.
placeholder: e.g. 
validations:
required: true
- type: checkboxes
id: checklist
attributes:
label: Checklist
description: Please check the following items before submitting your request.
options:
- label: I have searched the existing icons to make sure this icon does not already exist.
required: true
- label: I have searched the existing issues to make sure this icon has not already been requested.
required: true
- label: This icon is not a logo.
required: true
================================================
FILE: .github/ISSUE_TEMPLATE/02-bug-report.yml
================================================
name: 🐛 Bug report
description: Report a bug
title: 'Bug: '
labels: ['bug']
projects: ['feathericons/1']
body:
- type: textarea
id: description
attributes:
label: Description
description: "Tell us more about the problem that you're running into."
placeholder: 'e.g. When I try to do X, Y happens instead of Z'
validations:
required: true
- type: textarea
id: reproduce
attributes:
label: Steps to reproduce
description: 'How can we reproduce the error you described above? Please provide a link to a live example, or steps to reproduce locally.'
placeholder: |
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
validations:
required: true
- type: input
id: version
attributes:
label: Version
description: 'What version of `feather-icons` are you using?'
placeholder: e.g. v4.29.0
validations:
required: false
- type: dropdown
id: browser
attributes:
label: Browser
description: In which browser(s) are you experiencing the issue?
multiple: true
options:
- Chrome
- Safari
- Firefox
- Edge
- iOS Safari
- Other
validations:
required: false
- type: dropdown
id: os
attributes:
label: Operating system
description: On which operating system(s) are you experiencing the issue?
multiple: true
options:
- macOS
- Windows
- Linux
- iOS
- Android
- Other
validations:
required: false
- type: checkboxes
id: checklist
attributes:
label: Checklist
description: Please check the following items before submitting your issue.
options:
- label: I have searched the existing issues to make sure this bug has not already been reported.
required: true
================================================
FILE: .github/workflows/ci.yml
================================================
name: CI
on: push
jobs:
ci:
name: CI
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: 'npm'
- name: Install dependencies
run: npm ci --legacy-peer-deps
- name: Build
run: npm run build
- name: Test
run: npm run test:coverage
- name: Lint
run: npm run lint
- name: Optimize SVGs
run: |
npm run optimize-svgs
if git diff --quiet; then
echo "All SVGs are optimized ✔︎"
else
echo "The following SVGs are not optimized:"
git diff --name-only
echo
echo "Please run 'npm run optimize-svgs' and commit the changes"
exit 1
fi
================================================
FILE: .github/workflows/release.yml
================================================
name: Release
on:
push:
branches:
- main
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: 'npm'
- name: Install dependencies
run: npm ci --legacy-peer-deps
- name: Create release pull request or publish to npm
id: changesets
uses: changesets/action@v1
with:
title: 'Release'
publish: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
================================================
FILE: .gitignore
================================================
.DS_Store
node_modules
dist
sandbox
stash
coverage
================================================
FILE: .lintstagedrc
================================================
{
"*.js": "eslint"
}
================================================
FILE: .prettierignore
================================================
dist
coverage
================================================
FILE: CHANGELOG.md
================================================
# feather-icons
## 4.29.2
### Patch Changes
- [#1241](https://github.com/feathericons/feather/pull/1241) [`6e449d4`](https://github.com/feathericons/feather/commit/6e449d481e7ec7568103289eb4494999843b68ce) Thanks [@braden-godley](https://github.com/braden-godley)! - Feather no longer breaks when trying to replace an icon using an invalid name
## 4.29.1
### Patch Changes
- [#1213](https://github.com/feathericons/feather/pull/1213) [`8f0cc0e`](https://github.com/feathericons/feather/commit/8f0cc0e6667e88b7de391ccaf75820a6e57f4f13) Thanks [@colebemis](https://github.com/colebemis)! - Test [changesets](https://github.com/changesets/changesets) release
================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at cole@colebemis.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
================================================
FILE: CONTRIBUTING.md
================================================
# Contribution guidelines
First off, thanks for taking the time to contribute!
The following is a set of guidelines for contributing to Feather. Feel free to propose changes to this document in a pull request.
## Pull requests
> [!IMPORTANT]
> We are not accepting pull requests containing **icons**. If you want to add a new icon, please create an [icon request](#icon-requests).
Pull requests for bug fixes and improvements are welcome. If you’re not sure if something is worth doing, please open an issue first.
**Working on your first Pull Request?** You can learn how from this _free_ series
[How to Contribute to an Open Source Project on GitHub](https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github).
Here are a few things you can do that will increase the likelihood of your pull request being accepted:
- **Make your commit messages as descriptive as possible.** Include as much information as you can. Explain anything that might be unclear.
- **Document your pull request**. Explain your changes, link to the relevant issue, and add screenshots when applicable.
- **Include only related work**. If you have unrelated changes, please split them into separate pull requests.
## Icon requests
To request a new icon, please fill out the [icon request form](https://github.com/feathericons/feather/issues/new?template=01-icon-request.yml).
## Bug reports
To report a bug, please fill out the [bug report form](https://github.com/feathericons/feather/issues/new?template=02-bug-report.yml).
## Local development
Follow these steps to set up Feather for local development:
```shell
# 1. Clone the repository
git clone https://github.com/feathericons/feather.git
cd feather
# 2. Run setup script
npm run setup
```
================================================
FILE: LICENSE
================================================
The MIT License (MIT)
Copyright (c) 2013-2023 Cole Bemis
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
# Feather
[](https://codecov.io/gh/feathericons/feather)
[](https://www.npmjs.com/package/feather-icons)
[](https://www.npmjs.com/package/feather-icons)
[](https://cdnjs.com/libraries/feather-icons)
## What is Feather?
Feather is a collection of simply beautiful open-source icons. Each icon is designed on a 24x24 grid with an emphasis on simplicity, consistency, and flexibility.
https://feathericons.com
```shell
npm install feather-icons
```
## Table of contents
- [Quick start](#quick-start)
- [Usage](#usage)
- [Client-side JavaScript](#client-side-javascript)
- [Node](#node)
- [SVG sprite](#svg-sprite)
- [Figma](#figma)
- [API reference](#api-reference)
- [`feather.icons`](#feathericons)
- [`feather.icons[name].toSvg()`](#feathericonsnametosvgattrs)
- [`feather.replace()`](#featherreplaceattrs)
- [`feather.toSvg()` (DEPRECATED) ](#feathertosvgname-attrs-deprecated)
- [Contributing](#contributing)
- [Related projects](#related-projects)
- [License](#license)
## Quick start
Start with this [CodePen Template](https://codepen.io/pen?template=WOJZdM) to begin prototyping with Feather in the browser.
Or copy and paste the following code snippet into a blank `html` file.
```html
```
## Usage
At its core, Feather is a collection of [SVG](https://svgontheweb.com/#svg) files. This means that you can use Feather icons in all the same ways you can use SVGs (e.g. `img`, `background-image`, `inline`, `object`, `embed`, `iframe`). Here's a helpful article detailing the many ways SVGs can be used on the web: [SVG on the Web – Implementation Options](https://svgontheweb.com/#implementation)
The following are additional ways you can use Feather.
### Client-side JavaScript
#### 1. Install
> [!NOTE]
> If you intend to use Feather with a CDN, you can skip this installation step.
Install with [npm](https://docs.npmjs.com/getting-started/what-is-npm).
```shell
npm install feather-icons --save
```
Or just copy [`feather.js`](https://unpkg.com/feather-icons/dist/feather.js) or [`feather.min.js`](https://unpkg.com/feather-icons/dist/feather.min.js) into your project directory. You don't need both `feather.js` and `feather.min.js`.
#### 2. Include
Include `feather.js` or `feather.min.js` with a `
```
> [!NOTE]
> `feather.js` and `feather.min.js` are located in the `dist` directory of the npm package.
Or load the script from a CDN provider:
```html
```
After including the script, `feather` will be available as a global variable.
#### 3. Use
To use an icon on your page, add a `data-feather` attribute with the icon name to an element:
```html
```
See the complete list of icons at [feathericons.com](https://feathericons.com).
#### 4. Replace
Call the `feather.replace()` method:
```html
```
All elements that have a `data-feather` attribute will be replaced with SVG markup corresponding to their `data-feather` attribute value. See the [API Reference](#api-reference) for more information about `feather.replace()`.
### Node
#### 1. Install
Install with [npm](https://docs.npmjs.com/getting-started/what-is-npm):
```shell
npm install feather-icons --save
```
#### 2. Require
```js
const feather = require('feather-icons');
```
#### 3. Use
```js
feather.icons.x;
// {
// name: 'x',
// contents: '`,
// tags: ['cancel', 'close', 'delete', 'remove'],
// attrs: {
// class: 'feather feather-x',
// xmlns: 'http://www.w3.org/2000/svg',
// width: 24,
// height: 24,
// viewBox: '0 0 24 24',
// fill: 'none',
// stroke: 'currentColor',
// 'stroke-width': 2,
// 'stroke-linecap': 'round',
// 'stroke-linejoin': 'round',
// },
// toSvg: [Function],
// }
feather.icons.x.toSvg();
//
feather.icons.x.toSvg({ class: 'foo bar', 'stroke-width': 1, color: 'red' });
//
```
See the [API Reference](#api-reference) for more information about the available properties and methods of the `feather` object.
### SVG sprite
#### 1. Install
> [!NOTE]
> If you intend to use Feather with a CDN, you can skip this installation step.
Install with [npm](https://docs.npmjs.com/getting-started/what-is-npm).
```shell
npm install feather-icons --save
```
Or just copy [`feather-sprite.svg`](https://unpkg.com/feather-icons/dist/feather-sprite.svg) into your project directory.
#### 2. Use
Include an icon on your page with the following markup:
```html
```
> [!NOTE]
> `circle` in the above example can be replaced with any valid icon name. See the complete list of icon names at [feathericons.com](https://feathericons.com).
However, this markup can be simplified using a simple CSS class to avoid repetition of SVG attributes between icons:
```css
.feather {
width: 24px;
height: 24px;
stroke: currentColor;
stroke-width: 2;
stroke-linecap: round;
stroke-linejoin: round;
fill: none;
}
```
```html
```
### Figma
Feather is available as a [Figma component library](https://www.figma.com/file/dyJRSFTIajik4cdkcXN8yA3K/Feather-Component-Library). To use the components, log in to your Figma account and **duplicate** the file to your drafts.
## API reference
### `feather.icons`
An object with data about every icon.
#### Usage
```js
feather.icons.x;
// {
// name: 'x',
// contents: '',
// tags: ['cancel', 'close', 'delete', 'remove'],
// attrs: {
// class: 'feather feather-x',
// xmlns: 'http://www.w3.org/2000/svg',
// width: 24,
// height: 24,
// viewBox: '0 0 24 24',
// fill: 'none',
// stroke: 'currentColor',
// 'stroke-width': 2,
// 'stroke-linecap': 'round',
// 'stroke-linejoin': 'round',
// },
// toSvg: [Function],
// }
feather.icons.x.toString();
// ''
```
> [!NOTE]
> `x` in the above example can be replaced with any valid icon name. See the complete list of icon names at [feathericons.com](https://feathericons.com). Icons with multi-word names (e.g. `arrow-right`) **cannot** be accessed using dot notation (e.g. `feather.icons.x`). Instead, use bracket notation (e.g. `feather.icons['arrow-right']`).
[View Source](https://github.com/feathericons/feather/blob/master/src/icons.js)
---
### `feather.icons[name].toSvg([attrs])`
Returns an SVG string.
#### Parameters
| Name | Type | Description |
| ------------------ | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `attrs` (optional) | Object | Key-value pairs in the `attrs` object will be mapped to HTML attributes on the `