GithubHelp home page GithubHelp logo

surbhidighe / react-name-initials-avatar Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 32 KB

The react-name-initials-avatar is a lightweight and customizable React component that generates avatars based on user names or initials. This component is ideal for user profile displays, comment sections, or any application where you want to visually represent users with avatars.

License: MIT License

JavaScript 33.58% TypeScript 66.42%
component initials-avatar letter-avatar mit-license profile-picture react react-avatar react-hooks reactjs react-name-initials-avatar

react-name-initials-avatar's Introduction

react-name-initials-avatar

Npm Package Url - https://www.npmjs.com/package/react-name-initials-avatar

The react-name-initials-avatar is a lightweight and customizable React component that generates avatars based on user names or initials. This component is ideal for user profile displays, comment sections, or any application where you want to visually represent users with avatars.

React Name Initals Avatar

Features

  • Customizable - You can easily customize the appearance of the avatars by adjusting properties like size, background colors, text colors, and more.
  • Easy Integration - Integrating the React Name Initials Avatar into your project is simple. Just import the component and pass the necessary props.

Installation

yarn add react-name-initials-avatar

OR

npm install react-name-initials-avatar

Usage

To use the component, import it into your React application:

import {NameInitialsAvatar} from 'react-name-initials-avatar';

function UserProfile(props) {
  const { username } = props;

  return (
    <div className="user-profile">
      <NameInitialsAvatar
        name={username}
      />
      <h2>{username}</h2>
    </div>
  );
}

export default UserProfile;

In the above example, the NameInitialsAvatar component generates an avatar based on the user's name initials. You can customize the avatar's size, background color, border radius, font weight and text color according to your design.

Props

Key Default Type
name (required) undefined string
bgColor (optional) white string
textColor (optional) black string
size (optional) 40px string
borderRadius (optional) 50% string
textWeight (optional) bold string
textSize (optional) 16px string
borderColor (optional) black string
borderStyle (optional) solid string
borderWidth (optional) 2px string

Props Description

  1. name - name of user
  2. bgColor - set background color
  3. textColor - set text color
  4. size - set container size
  5. borderRadius - set border radius of container
  6. textWeight - set font weight of text. Accepted values - normal, bold, bolder, lighter, number, initial, inherit, 100 to 900
  7. textSize - set font size of text
  8. borderColor - set border color of container
  9. borderStyle - set border style of container. Accepted values - none, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset, initial, inherit
  10. borderWidth - set border width of container

react-name-initials-avatar's People

Contributors

surbhidighe avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.