> For the complete documentation index, see [llms.txt](https://dormakaba-digital.gitbook.io/reactnative-visual/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dormakaba-digital.gitbook.io/reactnative-visual/components/avatar.md).

# Avatar

## Preview

The component can:

* Display a user image or fallback based on given username string
* Display icons in colored circle or rectangle
* Display an additional border state `success`, `warning`, `error`, `info`

![Variation of possible looks and use cases](/files/-LGUqyS1bECgdxpjJiC-)

## Code sample

```jsx
import { Avatar } from '@dormakaba/digital-reactnative-visual';

// user avatar
<Avatar
  src="https://avatars2.githubusercontent.com/u/977772"
  name="Jan Mühlemann"
  circle
/>

// icon with state
<Avatar
  lightGray
  circle
  border="info"
/>
```

## Props

| **Name** | **Type** | **Description**                                                                                                                                                                     |
| -------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| icon     | string   | Icon name to display                                                                                                                                                                |
| src      | string   | Url to load image from                                                                                                                                                              |
| header   | object   | Optional header for the image load request                                                                                                                                          |
| name     | string   | Used to generate possible fallback value and color if no src is defined or was unable to load it                                                                                    |
| circle   | boolean  | true if you prefer displaying a circle                                                                                                                                              |
| \*       | boolean  | set any of following props as size options: `xlarge`, `large`, `small`, `xsmall` (default: `medium`)                                                                                |
| width    | int      | custom size                                                                                                                                                                         |
| \*       | boolean  | set background color by setting any of this props: `error`, `warning`, `success`, `info`, `white`, `darkGray`, `lightGray`, `labelGray`, `borderGray`, `label` (default `textGray`) |
| border   | string   | any color of: `success`, `warning`, `error`, `info`                                                                                                                                 |


---

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

```
GET https://dormakaba-digital.gitbook.io/reactnative-visual/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.
