---
title: "avatar"
description: "User image with text fallback."
category: "Data Display"
---
# avatar
User image with text fallback.
## Installation
```bash
php artisan ui:add avatar
```
## Dependencies
- composer: `gehrisandro/tailwind-merge-laravel`
## Usage
```blade
{{-- No src: the fallback initials are shown instead --}}
```
## Example
The demo rendered on the docs page.
```blade
```
## Source
Copy this file to the path shown above it.
`resources/views/components/ui/avatar.blade.php`
```blade
@props([
'src' => null,
'alt' => '',
'fallback' => null,
])
@php
$classes = \TailwindMerge\Laravel\Facades\TailwindMerge::merge(
'relative flex size-8 shrink-0 overflow-hidden rounded-full',
$attributes->get('class'),
);
@endphp
except('class')->merge(['class' => $classes]) }}>
@if ($src)
@else
{{ $fallback ?? $slot }}
@endif
```
## Theme tokens
`--muted`, `--muted-foreground`
Provide `src` + `alt`, or a `fallback` (initials).