랭킹으로 돌아가기

dapi-labs/react-nice-avatar

TypeScriptnice-avatar.wwayne.com

react library for generating avatar

reactreact-avatarreact-avatar-editoravataravatar-generatoravatar-placeholder
스타 성장
스타
1.3k
포크
122
주간 성장
이슈
5
5001k
2021년 5월2023년 1월2024년 10월2026년 7월
아티팩트npmnpm install react-nice-avatar
README

react-nice-avatar

Version npm download Build Status Netlify Status

Online editor / preview

Assets

Installation

npm install react-nice-avatar

or

yarn add react-nice-avatar

Usage

  1. Import the component.

    import Avatar, { genConfig } from 'react-nice-avatar'
    
  2. Generate a configuration

    Config can be generated with a seed, a seed is a string of name, email or any string you like

    const config = genConfig("hi@dapi.to") 
    

    or it can be generate with a customized object, plz check the Options below for what attributes can be passed in

    const config = genConfig({ sex: "man", hairStyle: "mohawk" }) 
    

    or generating a random config by passing nothing to the function genConfig

    const config = genConfig() 
    
  3. 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

key type default accept tips
id string Only for React Props
className string Only for React Props
style object Only for React Props
shape string circle circle, rounded, square Only for React Props
sex string man, woman
faceColor string
earSize string small, big
hairColor string
hairStyle string normal, thick, mohawk, womanLong, womanShort
hairColorRandom boolean false thick,mohawk default only be black
hatColor string
hatStyle string none, beanie, turban Usually is none
eyeStyle string circle, oval, smile
glassesStyle string none, round, square Usually is none
noseStyle string short, long, round
mouthStyle string laugh, smile, peace
shirtStyle string hoody, short, polo
shirtColor string
bgColor string
isGradient boolean false

Development

  1. Clone the repo:
    $ git clone git@github.com:dapi-labs/react-nice-avatar.git
    $ cd react-nice-avatar
    
  2. Install dependencies:
    $ yarn
    
  3. Start the server for the demo:
    $ make dev
    
  4. Open the browser to reivew the demo:
    $ open http://localhost:8080
    
  5. Edit the files inside src.

Test

  1. Lint test:

    $ make lint-test
    
  2. code test:

    $ make test
    

Release

$ make release level=patch | minor | major | 1.3.0

License

Released under MIT by @dapi-labs.

관련 저장소
freeCodeCamp/freeCodeCamp

freeCodeCamp.org's open-source codebase and curriculum. Learn math, programming, and computer science for free.

TypeScriptnpmBSD 3-Clause "New" or "Revised" Licenselearn-to-codenonprofits
contribute.freecodecamp.org
452.4k45.6k
react/react

The library for web and native user interfaces.

JavaScriptnpmMIT Licensejavascriptreact
react.dev
246.7k51.3k
facebook/react

The library for web and native user interfaces.

JavaScriptnpmMIT Licensejavascriptreact
react.dev
233k47.8k
vercel/next.js

The React Framework

JavaScriptnpmMIT Licensereactserver-rendering
nextjs.org
141.1k31.5k
react/react-native

A framework for building native applications using React

C++MIT Licenseandroidapp-framework
reactnative.dev
126.2k25.2k
facebook/react-native

A framework for building native applications using React

C++MIT Licenseandroidapp-framework
reactnative.dev
120.9k24.5k
shadcn-ui/ui

A set of beautifully-designed, accessible components and a code distribution platform. Works with your favorite frameworks. Open Source. Open Code.

TypeScriptnpmMIT Licensecomponentsnextjs
ui.shadcn.com
119.5k9.5k
justjavac/free-programming-books-zh_CN

:books: 免费的计算机编程类中文书籍,欢迎投稿

GNU General Public License v3.0pythonjavascript
weibo.com/justjavac
117.7k28.2k
nextlevelbuilder/ui-ux-pro-max-skill

An AI SKILL that provide design intelligence for building professional UI/UX multiple platforms

PythonPyPIMIT Licenseai-skillsantigravity
uupm.cc
108.6k11.6k
react/create-react-app

Set up a modern web app by running one command.

JavaScriptnpmMIT Licensereactzero-configuration
create-react-app.dev
103.3k26.9k
facebook/create-react-app

Set up a modern web app by running one command.

JavaScriptnpmMIT Licensereactzero-configuration
create-react-app.dev
103.1k27k
ant-design/ant-design

An enterprise-class UI design language and React UI library

TypeScriptnpmMIT Licensereactui-kit
ant.design
98.8k54.7k