npm package: @justeattakeaway/pie-avatar
Description: PIE Design System Avatar built using Web Components
Author: Just Eat Takeaway.com - Design System Team
Latest version: 0.4.25

# @justeattakeaway/pie-avatar
[Source Code](https://github.com/justeattakeaway/pie/tree/main/packages/components/pie-avatar) | [Design Documentation](https://pie.design/components/avatar) | [NPM](https://www.npmjs.com/package/@justeattakeaway/pie-avatar)

<p>
  <a href="https://www.npmjs.com/@justeattakeaway/pie-avatar">
    <img alt="GitHub Workflow Status" src="https://img.shields.io/npm/v/@justeattakeaway/pie-avatar.svg">
  </a>
</p>

`@justeattakeaway/pie-avatar` is a Web Component built using the Lit library. It offers a simple and accessible button component for web applications.

## Table of Contents

- [Installation](#installation)
- [Documentation](#documentation)
  - [Properties](#properties)
  - [Slots](#slots)
  - [CSS Variables](#css-variables)
  - [Events](#events)
- [Usage Examples](#usage-examples)
- [Questions and Support](#questions-and-support)
- [Contributing](#contributing)

## Installation

> To install any of our web components in your application, we would suggest following the [getting started guide](https://webc.pie.design/?path=/docs/introduction-getting-started--docs) to set up your project.

Ideally, you should install the component using the **`@justeattakeaway/pie-webc`** package, which includes all of the components. Or you can install the individual component package.

## Documentation

### Properties

| Prop | Options | Description | Default |
|------|---------|-------------|---------|
| `src` | — | The src attribute for the underlying image tag. | `""` |
| `tag` | "button",  "a",  "div" | Which HTML element to use when rendering the avatar.| `div` |
| `label` | - | User or company name that will be rendered as initials inside the avatar.| `""` |

### Slots
| Slot     | Description                                                                                                                                                                                                                                                                         |
|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|  | |

### CSS Variables
| Variable | Description                                                                                                                                                                                                                 | Default |
|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|
| | | |

### Events
| Event | Type                                                                                                                                                                                                                 | Description |
|------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------|
| | | |

## Usage Examples

**For HTML:**

```js
// import as module into a js file e.g. main.js
import '@justeattakeaway/pie-webc/components/avatar.js'
```

```html
<!-- pass js file into <script> tag -->

<script type="module" src="/main.js"></script>
```

**For Native JS Applications, Vue, Angular, Svelte etc.:**

```js
// Vue templates (using Nuxt 3)
import '@justeattakeaway/pie-webc/components/avatar.js'

```

**For React Applications:**

```jsx
import { PieAvatar } from '@justeattakeaway/pie-webc/react/avatar.js';

```

## Questions and Support

If you work at Just Eat Takeaway.com, please contact us on **#help-designsystem**. Otherwise, please raise an issue on [Github](https://github.com/justeattakeaway/pie/issues).

## Contributing

Check out our [contributing guide](https://github.com/justeattakeaway/pie/wiki/Contributing-Guide) for more information on [local development](https://github.com/justeattakeaway/pie/wiki/Contributing-Guide#local-development) and how to run specific [component tests](https://github.com/justeattakeaway/pie/wiki/Contributing-Guide#testing).