# @jamescoyle/svg-icon

> Icon webcomponent

Latest version **1.0.0** (published 2025-02-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install @jamescoyle/svg-icon
pnpm add @jamescoyle/svg-icon
yarn add @jamescoyle/svg-icon
bun add @jamescoyle/svg-icon
```

## Health

**Score 30/100 (F)** — status: maintenance-mode.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2025-02-03 |
| First published | 2020-10-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 12 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11 |
| Author | Pictogrammers, James Coyle |
| Maintainers | jamescoyle |
| Keywords | webcomponents, icon, mdi, pictogrammers |

## Links

- npm: https://www.npmjs.com/package/@jamescoyle/svg-icon
- Repository: https://github.com/JamesCoyle/svg-icon
- Homepage: https://github.com/JamesCoyle/svg-icon#readme
- Issues: https://github.com/JamesCoyle/svg-icon/issues
- npm.io page: https://npm.io/package/@jamescoyle/svg-icon

## Alternatives

- [@fortawesome/react-fontawesome](https://npm.io/package/@fortawesome/react-fontawesome.md) — 2.2M weekly downloads
- [roboto-fontface](https://npm.io/package/roboto-fontface.md) — 196.0K weekly downloads
- [@react-native-vector-icons/common](https://npm.io/package/@react-native-vector-icons/common.md) — 150.4K weekly downloads
- [stockfish](https://npm.io/package/stockfish.md) — 27.0K weekly downloads
- [@procore/core-icons](https://npm.io/package/@procore/core-icons.md) — 4.6K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2025-02-03
- 0.2.1 — 2024-09-11
- 0.1.1 — 2021-09-10
- 0.1.0 — 2020-10-08

## README

# SVG Icon WebComponent

[![](https://chips.james-coyle.now.sh/npm/version/@jamescoyle/svg-icon)](https://www.npmjs.com/package/@jamescoyle/svg-icon)
[![](https://chips.james-coyle.now.sh/npm/downloads/@jamescoyle/svg-icon)](https://www.npmjs.com/package/@jamescoyle/svg-icon)

A basic webcomponent for rendering a single path SVG icon. This component makes it easy to use SVG path based icon packs such as [MaterialDesignIcons](https://materialdesignicons.com/) and [SimpleIcons](https://simpleicons.org/).

# Usage

1. Install the package from NPM
    ```
    npm install @jamescoyle/svg-icon
    ```

2. Import the component into your application
    ```
    import '@jamescoyle/svg-icon'
    ```

3. Use the icon in your markup
    ```
    <svg-icon type="mdi" path="M...z"></svg-icon>
    ```

# Attributes

| Name    | Default     | Description                                                                                                                          |
| ------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| type    | null        | This sets the size and viewbox to match the recommended size for the icon pack specified.                                            |
| path    | null        | Required. An SVG path to render as an icon                                                                                           |
| size    | 24          | The width and height of the SVG element                                                                                              |
| viewbox | "0 0 24 24" | The `viewBox` of the SVG element                                                                                                     |
| flip    | null        | One of "horizontal", "vertical", or "both". Flips the icon in the specified direction(s).                                            |
| rotate  | 0deg        | Rotates the icon by the specified value. Can be any valid [CSS angle](https://developer.mozilla.org/en-US/docs/Web/CSS/angle) value. |

# Styling

By default the icon will inherit the current font color of the container it is placed within. You can easily provide a specific color using an inline style on the element (`style="color: red"`) or can target the tag as normal with CSS rules.

# Accessibility

You should make use of aria attributes to improve accessibility for users that use screen reading technology. You can use `aria-labelledby` to create a link between an icon and its label. A descriptive `aria-label` can be used to allow screen readers to announce an icon if there is no visual label to accompany it.

---
_Source: https://npm.io/package/@jamescoyle/svg-icon · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
