# @coopdigital/shared-component--icon

> Co-op Shared Component: Icon

Latest version **2.2.0** (published 2023-12-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install @coopdigital/shared-component--icon
pnpm add @coopdigital/shared-component--icon
yarn add @coopdigital/shared-component--icon
bun add @coopdigital/shared-component--icon
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.0 |
| Published | 2023-12-13 |
| First published | 2020-12-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 27.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | @coopdigital |
| Maintainers | coopexperience, omidantilong, mitcheh, matt-tyas, joemcgirr, hanross, coopjames |

## Links

- npm: https://www.npmjs.com/package/@coopdigital/shared-component--icon
- Repository: https://github.com/coopdigital/coop-frontend
- Homepage: https://github.com/coopdigital/coop-frontend#readme
- Issues: https://github.com/coopdigital/coop-frontend/issues
- npm.io page: https://npm.io/package/@coopdigital/shared-component--icon

## Recent versions

- 2.2.0 (latest) — 2023-12-13
- 2.1.2 — 2022-01-11
- 2.1.1 — 2021-06-28
- 2.1.0 — 2021-03-30
- 2.0.0 — 2021-03-03
- 1.0.2 — 2021-02-19
- 1.0.1 — 2021-02-17
- 1.0.0 — 2021-02-16
- 0.2.0 — 2020-12-14

## README

# shared-component--icon
A macro to return an SVG icon based on a value passed in.

## Installation
Install with NPM:
```bash
$ npm install @coopdigital/shared-component--icon --save
```

## Usage
Once installed, you can import icon.html from the shared components directory like you might do for squircles or editorial cards:

```
{% import '/shared-component--icon/src/icon.html' as icon %}
```

It can then be used from within your template as follows:

```
{%- set iconName = content.fields.icon | lower | replace(" ","_") -%}
{%- set iconClass = "coop-c-signpost__icon__svg" -%}

{{ icon.render(iconName, iconClass) }}
```

## Development
For information on how to develop this package see the [developing foundations and components for the design system documentation](https://github.com/coopdigital/coop-frontend/blob/master/packages/README.md).

## License
Copyright (c) 2021 Co-operative Group Limited.
Licensed [MIT](https://github.com/coopdigital/coop-frontend/blob/master/LICENSE).

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