🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

react-nice-avatar

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-nice-avatar

react library for generating avatar

1.1.2
Source
npm
Version published
Weekly downloads
3.1K
-20.37%
Maintainers
1
Weekly downloads
 
Created
Source

react-nice-avatar

Version npm download

Online editor / preview

Assets

Installation

npm install react-nice-avatar

or

yarn add react-nice-avatar

Usage

  • Import the component
    import Avatar, { genConfig } from 'react-nice-avatar'
    
  • Generate random config, the config can be saved into your database to use later
    const config = genConfig(AvatarConfig?)
    
  • Render the component with specific width / height and configuration
    <Avatar style={{ width: '8rem', height: '8rem' }} {...config} />
    
    or
    <Avatar className="w-32 h-32" {...config} />
    

Options

The options can be passed into genConfig or as React props

keytypedefaultaccepttips
idstringOnly for React Props
classNamestringOnly for React Props
styleobjectOnly for React Props
shapestringcirclecircle, rounded, squareOnly for React Props
sexstringman, woman
faceColorstring
earSizestringsmall, big
hairColorstring
hairStylestringnormal, thick, mohawk, womanLong, womanShort
hairColorRandombooleanfalsethick,mohawk default only be black
eyeStylestringcircle, oval, smile
glassesStylestringnone, round, squareUsually is none
noseStylestringshort, long, round
mouthStylestringlaugh, smile, peace
shirtStylestringhoody, short, polo
shirtColorstring
bgColorstring

Development

  • Clone the repo:
    $ git clone git@github.com:chilllab/react-nice-avatar.git
    $ cd react-nice-avatar
    
  • Install dependencies:
    $ yarn
    
    Or
    $ npm install
    
  • Start the server for the demo:
    $ make dev
    
  • Open the browser to reivew the demo:
    $ open http://localhost:5555
    
  • Edit the files inside src.

License

Released under MIT by @chilllab.

Keywords

react

FAQs

Package last updated on 15 Jun 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts