npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-name-initials-avatar

v0.0.7

Published

Creating Stylish Initial-Based Avatars in React

Downloads

4,722

Readme

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 | number | | 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