Color Generator

Generate and export Tailwind color patterns.

Brand Colors

primary
secondary

State Colors

info
success
warning
error

Color Picker

Avatar

Detailed documentation for the Avatar component in the PixelBlockUI library.

Overview

The Avatar component displays an image or fallback content with customizable size, border, color, and radius.

Installation

You can install the Avatar component using the PixelBlock CLI tool.

npx pixelblock-cli add Avatar

Usage

Basic Usage

Display a basic avatar with an image:

Loading...

Avatar with Border

Display an avatar with a border:

Loading...

Avatar with Different Sizes

Display avatars with different sizes:

Loading...

Avatar with Different Colors

Display avatars with different background colors:

Loading...

Avatar with Custom Radius

Display avatars with custom border radius:

Loading...

Props

Avatar Props

The Avatar component accepts the following props:

PropTypeDefault ValueDescription
srcstringThe URL of the image to display.
namestringName to generate initials for fallback content when src is not provided.
size'sm' | 'md' | 'lg''md'Size of the avatar.
isBorderedbooleanfalseWhether to display a border around the avatar.
color'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'danger''default'Background color of the avatar.
radius'none' | 'sm' | 'md' | 'lg' | 'full''full'Border radius of the avatar.
classNamestringAdditional CSS classes to apply to the avatar container.

Conclusion

The Avatar component provides flexibility in displaying user avatars with various configurations. By utilizing Tailwind CSS classes and props, it seamlessly integrates into your React or Next.js projects.

For more information and detailed usage instructions, refer to the PixelBlockUI Documentation.