> For the complete documentation index, see [llms.txt](https://yashs-organization-7.gitbook.io/modular-ui-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yashs-organization-7.gitbook.io/modular-ui-documentation/avatars.md).

# Avatars

## Avatars

## MUIAvatars

A versatile avatar widget with support for images and fallback text.

### Properties

* **`imageUrl`**: *String* - Image URL for the avatar. If the URL starts with 'http', it is treated as a network image; otherwise, it is treated as an asset image.
* **`size`**: *double* - Size of the avatar, default: `32`.
* **`fallbackText`**: *String* - Fallback text for the avatar, limited to 2 characters.
* **`onTap`**: *VoidCallback* - Callback function to be executed when the avatar is tapped.
* **`textColor`**: *Color* - Text color for the fallback text.

### Example Usage

Avatar with url and default size

```dart
MUIAvatar(
            imageUrl: "https://github.com/shadcn.png",
            fallbackText: "ABCD",
            onTap: () {},
            textColor: Colors.blue,
          ),
```

Avatar without url with fallback text and default size

```dart
MUIAvatar(
            imageUrl: "",
            fallbackText: "AC",
            onTap: () {},
            textColor: Colors.green,
          ),
```

Avatar with user defined size

```dart
MUIAvatar(
            imageUrl: "",
            fallbackText: "AB",
            size: 50,
            onTap: () {},
            textColor: Colors.red,
          ),**
```

Avatar with user defined size and url

```dart
MUIAvatar(
            imageUrl: "https://github.com/shadcn.png",
            fallbackText: "AB",
            size: 50,
            onTap: () {},
            textColor: Colors.red,
          ),
```

### **Notes**

* Provides a customizable avatar with support for images and fallback text.
* Image URL can be either a network image or an asset image.
* Fallback text is displayed if the image URL is empty or invalid.
* Allows customization of size, fallback text, tap callback, and text color.
* Fallback text is truncated to 2 characters.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://yashs-organization-7.gitbook.io/modular-ui-documentation/avatars.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
