Back to Filament

Avatar Blade component

docs/12-components/03-avatar.md

5.6.21.3 KB
Original Source

import AutoScreenshot from "@components/AutoScreenshot.astro"

Introduction

The avatar component is used to render a circular or square image, often used to represent a user or entity as their "profile picture":

blade
<x-filament::avatar
    src="https://filamentphp.com/dan.jpg"
    alt="Dan Harrin"
/>
<AutoScreenshot name="components/avatar/simple" alt="Avatars" version="5.x" />

Setting the rounding of an avatar

Avatars are fully rounded by default, but you may make them square by setting the circular attribute to false:

blade
<x-filament::avatar
    src="https://filamentphp.com/dan.jpg"
    alt="Dan Harrin"
    :circular="false"
/>
<AutoScreenshot name="components/avatar/square" alt="Square avatars" version="5.x" />

Setting the size of an avatar

By default, the avatar will be "medium" size. You can set the size to either sm, md, or lg using the size attribute:

blade
<x-filament::avatar
    src="https://filamentphp.com/dan.jpg"
    alt="Dan Harrin"
    size="lg"
/>
<AutoScreenshot name="components/avatar/sizes" alt="Avatars in different sizes" version="5.x" />

You can also pass your own custom size classes into the size attribute:

blade
<x-filament::avatar
    src="https://filamentphp.com/dan.jpg"
    alt="Dan Harrin"
    size="w-12 h-12"
/>