Ship faster with goilerplate templUI Pro

Avatar

Visual representation of a user through images or initials.

Source Tailwind CSS JavaScript

User avatar

Installation

  1. Install the component

    templui add avatar
  2. Add the JavaScript to your layout

    @avatar.Script()
    

    Call this template in your base layout file (e.g., in the <head> section).

Examples

Fallback

John Doe avatar JD

Sizes

Small avatar SM
Default avatar MD
Large avatar LG
Extra large avatar XL

With Icon

Group

User avatar AA
User avatar BB
User avatar CC
+2

API Reference

Required parameter
Hover for description

Avatar

Root container for avatar component. Default size is 8 (size-8). Use the Class prop to customize size and styling.

Name Type Default
ID
string
-
Class
string
-
Attributes
templ.Attributes
-

Image

Image element within the avatar that displays the user's photo.

Name Type Default
ID
string
-
Class
string
-
Attributes
templ.Attributes
-
Src
string
-
Alt
string
-

Fallback

Fallback element displayed when the image fails to load, typically showing initials or an icon.

Name Type Default
ID
string
-
Class
string
-
Attributes
templ.Attributes
-