0.0.2 • Published 5 months ago

react-ts-droid-avatar v0.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

Avatar

DroidAvatar is a customizable React component for displaying user avatars with various styling options. It's written in TypeScript for better type safety and maintainability.

Features

  • Customizable appearance (variant, size, colors)
  • Supports image and text avatars
  • Optional badge support
  • Grouped avatars
  • TypeScript support for type safety

Installation

To use the Avatar component in your React application, install it via npm:

npm install react-ts-droid-avatar

Usage

To use the Avatar component, import it and provide the required props:

import { Avatar } from "react-ts-droid-avatar";

<DroidAvatar
  variant="circular"
  type="image"
  src="path/to/image.jpg"
  alt="User Avatar"
  size={48}
  fontSize={20}
  color="#fff"
  bgcolor="#bdbdbd"
  badgeContent="!"
  badgeColor="#fff"
  badgeBgColor="#bdbdbd"
  badgeSize={20}
  group={false}
/>;

Props

The Avatar component accepts the following props:

PropTypeRequiredDescription
variantAvatarVariantNoThe shape of the avatar (circular, rounded, square)
typeAvatarTypeNoThe type of the avatar (image, text)
srcstringNoThe source URL of the image (required if type is image)
altstringNoThe alt text for the image
childrenReact.ReactNodeNoThe content to display if type is text
sizenumberNoThe size of the avatar
fontSizenumberNoThe font size of the text
colorstringNoThe text color
bgcolorstringNoThe background color
badgeContentReact.ReactNodeNoThe content to display in the badge
badgeColorstringNoThe text color of the badge
badgeBgColorstringNoThe background color of the badge
badgeSizenumberNoThe size of the badge
groupbooleanNoWhether the avatar is part of a group

The Avatar component provides a flexible and customizable way to display user avatars in your React application. With its various styling options and TypeScript support, it can easily be integrated into your project and styled to match your design requirements.

License

This project is licensed under the MIT License.

0.0.2

5 months ago