• Stars
    star
    750
  • Rank 60,494 (Top 2 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created almost 7 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

React component for avataaars

React component for Avataaars

The core React component for Avataaars Generator developed by Fang-Pen Lin, based on the Sketch library Avataaars designed by Pablo Stanley.

Features

  • SVG based
  • Light weight
  • Scalable
  • Easy to use
  • Easy to integrate with custom editor
  • Comes with official editor

Usage

First, you need to install the avataaars component package, here you run

yarn add avataaars

or

npm install avataaars --save

if you are using npm. Then, in your React app, import the Avataaar component and put it where you like it to be, for example

import * as React from 'react'
import Avatar from 'avataaars'

export default class MyComponent extends React.Component {
  render () {
    return 
      <div>
        Your avatar:
        <Avatar
          style={{width: '100px', height: '100px'}}
          avatarStyle='Circle'
          topType='LongHairMiaWallace'
          accessoriesType='Prescription02'
          hairColor='BrownDark'
          facialHairType='Blank'
          clotheType='Hoodie'
          clotheColor='PastelBlue'
          eyeType='Happy'
          eyebrowType='Default'
          mouthType='Smile'
          skinColor='Light'
        />
      </div>
  }
}

To showcase individual pieces of the avatar you can use the Piece component, for example:

import * as React from 'react'
import {Piece} from 'avataaars';

export default class MyComponent extends React.Component {
  render () {
    return 
      <div>
        <Piece pieceType="mouth" pieceSize="100" mouthType="Eating"/>
        <Piece pieceType="eyes" pieceSize="100" eyeType="Dizzy"/>
        <Piece pieceType="eyebrows" pieceSize="100" eyebrowType="RaisedExcited"/>
        <Piece pieceType="accessories" pieceSize="100" accessoriesType="Round"/>
        <Piece pieceType="top" pieceSize="100" topType="LongHairFro" hairColor="Red"/>
        <Piece pieceType="facialHair" pieceSize="100" facialHairType="BeardMajestic"/>
        <Piece pieceType="clothe" pieceSize="100" clotheType="Hoodie" clotheColor="Red"/>
        <Piece pieceType="graphics" pieceSize="100" graphicType="Skull" />
        <Piece pieceType="skin" pieceSize="100" skinColor="Brown" />
      </div>
  }
}

To explore avatar options and generate the React code, please use Avataaars Generator

Collect options

To build your own avatar editor, you may want to use lower level Avatar component along with OptionContext. For more details usage, please reference to source code of avataaars-generator, see how it uses OptionContext to collection available options.

More Repositories

1

avataaars-generator

Simple generator React app for avataaars
TypeScript
2,783
star
2

bugbuzz-python

Fall in love with debugging
Python
103
star
3

loso

Chinese segmentation library
Python
83
star
4

elliptic-curve-explained

Jupyter notebook for explaining elliptic curve encryption
Jupyter Notebook
82
star
5

ansible-docker-demo

A simple ansible project for demonstrating how to build a docker image
Shell
46
star
6

gluttony

Gluttony is a tool for finding dependency relationships among Python packages, it is based on pip.
Python
23
star
7

swiftsense

JavaScript
17
star
8

ansible-inside-docker-demo

This repo demonstrates how to pack an Ansible playbook into a docker image
Shell
16
star
9

open-doodles

Open Doodles
TypeScript
12
star
10

framework-playbook

Ansible Playbook for Framework laptop basic setup
12
star
11

crane

Dockerfile builder
Python
11
star
12

eth2-validator-helm

Helm Chart for running ETH2 validator with OpenEthereum + Lighthouse
Mustache
10
star
13

Proj4Swift

Proj.4 wrapper in Swift 2 language
Swift
9
star
14

docker-eb-demo

An example demonstrates how to run a Docker app with AWS Elastic Beanstalk
Python
9
star
15

todoist-location-labels

Todoist service for adding location reminder for specific label
HTML
8
star
16

pyramid-handy

Some handy stuff for Pyramid web framework
Python
2
star
17

pyramid_genshi

Python
2
star
18

bugbuzz-dashboard

Dashboard for bugbuzz
JavaScript
2
star
19

billy-client

Python
2
star
20

rocket-launcher

Cookiecutter template project for production ready Flask web app
Python
2
star
21

GreenCloud

Python
1
star
22

design-patterns

Design patterns for Python
Python
1
star
23

rocket-launcher-sampleapp

Sample app generated from rocket-launcher project template
Python
1
star
24

python-hge

C++
1
star
25

docker-kill-different-user-process-bug

A docker image for reproducing not "Operation not permitted" to kill different user bug
Shell
1
star
26

billy-chef

Chef code for Billy integration testing and deployment
Ruby
1
star