# Astro Icon
This **[Astro integration](https://docs.astro.build/en/guides/integrations-guide/)** provides a straight-forward `Icon` component for [Astro](https://astro.build).
- [Why Astro Icon](#why-astro-icon)
- [Installation](#installation)
- [Usage](#usage)
- [Configuration](#configuration)
- [Examples](#examples)
- [Migrating to v1](#migrating-to-v1)
- [Contributing](#contributing)
- [Changelog](#changelog)
## Why Astro Icon
## Installation
### Quick Install
The `astro add` command-line tool automates the installation for you. Run one of the following commands in a new terminal window. (If you aren't sure which package manager you're using, run the first command.) Then, follow the prompts, and type "y" in the terminal (meaning "yes") for each one.
```sh
# Using NPM
npx astro add astro-icon
# Using Yarn
yarn astro add astro-icon
# Using PNPM
pnpm astro add astro-icon
```
If you run into any issues, [feel free to report them to us on GitHub](https://github.com/natemoo-re/astro-icon/issues) and try the manual installation steps below.
### Manual Install
First, install the `astro-icon` package using your package manager. If you're using npm or aren't sure, run this in the terminal:
```sh
npm install astro-icon
```
Then, apply this integration to your `astro.config.*` file using the `integrations` property:
**`astro.config.mjs`**
```js
import { defineConfig } from "astro/config";
import icon from "astro-icon";
export default defineConfig({
integrations: [icon()],
});
```
## Usage
Astro Icon is ready to use, with zero additional configuration. The included `Icon` component allows you to inline `svg`s directly into your HTML. Repeasted
### Local Icons
By default, Astro Icon supports custom local `svg` icons. They are optimized with [`svgo`](https://github.com/svg/svgo) automatically with no extra build step. See ["A Pretty Good SVG Icon System"](https://css-tricks.com/pretty-good-svg-icon-system/#just-include-the-icons-inline) from CSS Tricks.
1. Create a directory inside of `src/` named `icons/`.
2. Add each desired icon as an individual `.svg` file to `src/icons/`
3. Reference a specific icon file using the `name` prop.
```astro
---
import { Icon } from 'astro-icon/components';
---
```
## Iconify Icons
Astro Icon also supports [Iconify](https://iconify.design) icon sets out-of-the-box.
1. Find an Icon Set to use on the [Iconify Icon Sets website](https://icon-sets.iconify.design/)
2. Install the package (eg. `npm i -D @iconify-json/mdi`)
3. Reference a specific icon using the `name` prop with (eg. `mdi:account`)
```astro
---
import { Icon } from 'astro-icon/components'
---
```
### Props
The `Icon` component allows these custom properties:
```ts
interface Props extends HTMLAttributes<"svg"> {
/**
* References a specific Icon
*/
name: string;
"is:inline"?: boolean;
title?: string;
desc?: string;
size?: number | string;
width?: number | string;
height?: number | string;
}
```
The `Icon` also accepts any global HTML attributes and `aria` attributes. They will be forwarded to the rendered `