# @bliss-design-system/icon

> Bliss Design Sytem icon web component, consumes icons from Bliss Iconsets toolkit

Latest version **2.6.0** (published 2022-05-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install @bliss-design-system/icon
pnpm add @bliss-design-system/icon
yarn add @bliss-design-system/icon
bun add @bliss-design-system/icon
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.6.0 |
| Published | 2022-05-17 |
| First published | 2021-02-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 226.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | bryter-bliss, coolcut, gvonkoss, kilmc |
| Keywords | icon, web components, bliss, lit |

## Links

- npm: https://www.npmjs.com/package/@bliss-design-system/icon
- Repository: https://gitlab.com/bliss-design-system/components
- Homepage: https://gitlab.com/bliss-design-system/components#readme
- Issues: https://gitlab.com/bliss-design-system/components/issues
- npm.io page: https://npm.io/package/@bliss-design-system/icon

## Dependencies (3)

- [tslib](https://npm.io/package/tslib.md) ^2.0.3
- [lit-html](https://npm.io/package/lit-html.md) ^1.3.0
- [lit-element](https://npm.io/package/lit-element.md) ^2.4.0

## 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

- 2.6.0 (latest) — 2022-05-17
- 2.0.0-beta.0.4 (beta.0) — 2021-03-03
- 2.5.0 — 2022-05-17
- 2.4.0 — 2022-05-17
- 2.3.0 — 2022-05-16
- 2.2.1 — 2022-05-09
- 2.2.0 — 2022-05-09
- 2.1.1 — 2021-09-21
- 2.1.0 — 2021-08-10
- 2.0.1 — 2021-03-10
- 2.0.0 — 2021-03-04
- 2.0.0-beta.0.3 — 2021-03-02
- 2.0.0-beta.0.2 — 2021-03-02
- 2.0.0-beta.0.1 — 2021-03-02
- 2.0.0-beta.0.0 — 2021-03-02
- … 4 more at https://npm.io/package/@bliss-design-system/icon/versions

## README

# \<bliss-icon>

`<bliss-icon>` renders an icon to the page. This web component has been designed to render the icons from the [Bliss Iconsets toolkit](https://gitlab.com/bliss-design-system/iconsets). Every icon component needs to have a `name` attribute.

By design, icons can only be rendered at 24x24 px (`medium`) or 48x48 px (`large`).

- [Installation](#-installation)
- [Usage](#-usage)
  - [Properties](#properties)
  - [Styling](#styling)
- [Contributing](#-contributing)
  - [Demoing with Storybook](#demoing-with-storybook)
  - [Testing](#testing)
  - [Committing](#committing)
  - [Opening a merge request](#opening-a-merge-request)
- [Troubleshooting](#-troubleshooting)

## 📦 Installation

> ⚠️ You'll need the Iconsets toolkit installed in order to use this component. You can find the [installation instructions here](https://gitlab.com/bliss-design-system/iconsets#-usage).

To install this component, run:

```bash
yarn add @bliss-design-system/icon
```

## 🏎 Usage

To use this component, you'll need to register the component to the `window`'s [Custom Elements Registry](https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry). In order to achieve that, you'll want to call this function within your application's client-facing entry file:

```js
import { blissRegisterIcon } from '@bliss-design-system/icon';

blissRegisterIcon(); // Registers <bliss-icon>
```

That will make the component available in your application and you can use it like this:

```html
<!-- Render trash icon at medium size -->
<bliss-icon name="trash"></bliss-icon>
```

### Properties

The component accepts the following properties:

| Property        | Type           | Description                | Default | Required | Options |
| --------------- |:--------------:| :-------------------------:|:-------:|:--------:|:-------:|
| name            | String         | Size of the icon component |         | true     | [Available icons](https://bliss.bryter.dev/0d64ef553/p/65def8-bliss-icons/b/41d9e3)
| size            | String         | Size of the icon component | `medium`  | false    | `medium` or `large`

### Styling
The `<bliss-icon>` component doesn't have any explicit styles. If you want to change the `size` of the component, you need to use the `size` attribute. 

```html
<!-- Render trash icon at large size -->
<bliss-icon name="trash" size="large"></bliss-icon>
```

By default, the icon will inherit its parent element `color` property. This means that if you are using a `<bliss-icon>` component inside a button and the text color is red, the icon will inherit this color value and will be red. However, if you wish to color the icon differently you can do so by doing the following:

```css
bliss-icon {
  color: blue;
}
```

You can also use the pattern above to apply any other CSS properties to the `bliss-icon` element, but keep in mind that this won't change the `svg` inside the `<bliss-icon>`, it only affects the element itself.

## 🫕 Contributing

If you'd like to contribute, please open an issue with your suggested change on our [Proposal Board](). Once that is accepted, either the Bliss team will work on it or you can make changes locally by doing the following:

```bash
# Clone this repository
git clone https://gitlab.com/bliss-design-system/components.git

# Move into the icon package
cd components/packages/icon

# Install the dependencies
yarn
```

### Demoing with Storybook

You can see all of your changes as you make them on Storybook.

To run a local instance of Storybook for this component, run:

```bash
yarn storybook
```

### Testing

If you want to test as you develop, run:

```bash
yarn test
```

Please note that the build pipeline will fail if coverage drops by more than 5%. 

### Committing

We follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/), meaning that you'll be prompted to fill out a descriptive message when you commit. We also use these commits to manage our releases, so we appreciate details.

As a guideline for this component, we use:
- `fix` for bug fixes, minor stylistic improvements, etc.
- `feat` for any backward compatible API changes.

For anything that breaks backwards compatibility or introduces significant changes that require a major version change, please get in touch with the team.

### Opening a merge request

When you're ready to open a merge request, please use a descriptive title and fill out the provided template.

The team will be notified, but it helps to post your merge request in [#bliss_support](https://bryterworkspace.slack.com/archives/CLBTUEQ5P).

## 🙃 Troubleshooting

We'll fill this section out as we go and as issues are raised. But if you haven't found what you're looking for, get in touch via [bliss@bryter.io](mailto:bliss@bryter.io) or via the [#bliss_support](https://bryterworkspace.slack.com/archives/CLBTUEQ5P) Slack channel ✨.

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