# Avatar

The `Avatar` component is an image element with a fallback text for representing the user.&#x20;

### Preview

<div align="left"><figure><img src="/files/G7rDcGdr4ZCrfAiKJmeG" alt="Gravity avatar component" width="94"><figcaption></figcaption></figure></div>

### Usage

```javascript
import { Avatar } from 'components/lib';

function MyComponent({ ...props }){
  return (
    <Avatar src='path/to/image.jpg' fallback='KG' />
  );
}
```

### Props

| Prop      | Description                               | Required | Value                   |
| --------- | ----------------------------------------- | -------- | ----------------------- |
| className | custom styles                             | optional | SCSS or Tailwind object |
| fallback  | Fallback text when image is not available | optional | string                  |
| src       | Image source URL                          | optional | string                  |

### Notes

* The `Avatar` component uses `AvatarPrimitive.Root`, `AvatarPrimitive.Image`, and `AvatarPrimitive.Fallback` from `@radix-ui/react-avatar`.
* Custom styles can be applied using the `className` prop.
* The `src` prop specifies the source URL for the avatar image.
* The `fallback` prop provides fallback content when the image is missing.
* For more details, refer to the [Shadcn Avatar documentation.](https://ui.shadcn.com/docs/components/avatar)


---

# Agent Instructions: 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:

```
GET https://docs.usegravity.app/gravity-web/components/avatar.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
