react-ui-avatars

3.0.2 • Public • Published

react-ui-avatars

Wrapper component for https://ui-avatars.com

Generate avatars from a users intials.

Credit to @LasseRafn for his awesome API.

Demo

https://codepen.io/novigradian/pen/qMwJgg

Installing

Using npm:

npm install react-ui-avatars

Usage

import ReactDOM from 'react-dom';
import React from 'react';
import UIAvatar from 'react-ui-avatars';
 
ReactDOM.render(
  <UIAvatar name='Warren Zevon' color='#551a8b' />,
  document.getElementById('#container')
);

Options

Pass props same as specified at https://ui-avatars.com.

Example:

<UIAvatar name='Warren Zevon' size={128} />

Extra props are passed on to <img /> element.

Global Settings

Global settings for your app can be configured. The properties are the same as the props.

The global settings can be overriden on an individual instance of the component by passing the prop.

import ReactDOM from 'react-dom';
import React from 'react';
import UIAvatar from 'react-ui-avatars';
 
UIAvatar.settings = {
  size: 128,
  rounded: true
};
 
ReactDOM.render(
  <UIAvatar name='Warren Zevon' />,
  document.getElementById('#container')
);

Readme

Keywords

Package Sidebar

Install

npm i react-ui-avatars

Weekly Downloads

49

Version

3.0.2

License

MIT

Unpacked Size

64.9 kB

Total Files

8

Last publish

Collaborators

  • ozzywalsh