# react-profile-avatar

> Render a user avatar with either initials or an image.

Latest version **1.0.0** (published 2021-07-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-profile-avatar
pnpm add react-profile-avatar
yarn add react-profile-avatar
bun add react-profile-avatar
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2021-07-08 |
| First published | 2021-07-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 0 |
| Unpacked size | 31.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | DarylBuckle |
| Maintainers | darylbuckle |
| Keywords | react, avatar, user, profile |

## Links

- npm: https://www.npmjs.com/package/react-profile-avatar
- Repository: https://github.com/DarylBuckle/react-profile-avatar
- Homepage: https://github.com/darylbuckle/react-profile-avatar/
- Issues: https://github.com/DarylBuckle/react-profile-avatar/issues
- npm.io page: https://npm.io/package/react-profile-avatar

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2021-07-08

## README

# react-profile-avatar

> Render a user avatar with either their initials or an image.

[![NPM](https://img.shields.io/npm/v/react-profile-avatar.svg)](https://www.npmjs.com/package/react-profile-avatar) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)


## Contents

* [Install](#install)
* [Usage](#usage)
* [Props](#props)
* [License](#license)

<br/>

## Install

```bash
npm install --save react-profile-avatar
```

## Usage

```tsx
import React, { Component } from 'react'

import { Avatar } from 'react-profile-avatar'
import 'react-profile-avatar/dist/index.css'

class Example extends Component {
  render() {
    return (
      <Avatar 
        name={'John Doe'}
        colour={'#FF0000'}
      />
    )
  }
}
```

See the [Examples](./example) for more info and advanced usage.

Build the Examples with `npm install` and then `npm start` to start the development server at [http://localhost:3000](http://localhost:3000).

Or view the online examples at [https://darylbuckle.github.io/react-profile-avatar/](https://darylbuckle.github.io/react-profile-avatar/).


## Props

| Property | Type | Description |
| -------- |------| ------------|
|    name | string | The name of the User. Used in the title and used to calculate the initials.
|    initials | string | Override the initials in the avatar. Recommended 2 characters max.
|    colour | string (hex e.g #000000) | Change the background colour of the avatar.
|    imageSrc | string | Url of an image. If set this will replace the initials. This can also be a Base64 string.
|    size | number | Size in pixels of the avatar. Default is 36px.
|    borderSize | number | Add a border to the outside of the avatar. Shows if greater than 0. Size is in pixels.
|    borderColour | string (hex e.g #000000) | Change the colour of the border.
|    onClick | function | Callback when clicking on the avatar.
|    style | css object | Apply additional styles to the avatar circle.
|    className | string | Apply additional classes to the avatar circle.
|    borderStyle | css object | Apply additional styles to the border.
|    borderClassName | string | Apply additional classes to the border.
|    containerStyle | css object | Apply additional styles to the container.
|    containerClassName | string | Apply additional classes to the container.
|    children | JSX | Render child components within the avatar.

<br/>


## License

MIT © [DarylBuckle](https://github.com/DarylBuckle) 2021

---
_Source: https://npm.io/package/react-profile-avatar · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
