Skip to content
Documentation

Avatar

Display profile pictures, user avatars or initials

Overview
Miru dashboard in a light theme

The Avatar component is a versatile and reusable component that allows us to display user avatars or profile pictures in our app. We can customize it by passing various props to suit our component needs. In this guide, we’ll walk through how to use the Avatar component in codebase.

Importing the Avatar Component

To use the Avatar component in our app, we need to import it from our styled components. Here’s how we can import it:

import { Avatar } from "StyledComponents";

default avatar

Using the Avatar Component

The Avatar component can be used with various props to control its appearance. Here are some examples of how we can use it:

<Avatar
  url={company.logo || logo}
/>

avatar with url

<Avatar
  name="Hello Moto"
/>

avatar with name

<Avatar
  name="Hello Moto"
  initialsLetterCount={1}
/>

avatar with name

<Avatar
  classNameImg="mr-5"
  classNameInitials="lg:text-5xl text-lg font-bold capitalize text-white"
  classNameInitialsWrapper="mr-5 bg-foreground"
  initialsLetterCount={1}
  name={company.name}
  size="h-10 w-10 lg:h-20 lg:w-20"
  url={company.logo || logo}
/>

Avatar Component Props

NameDescriptionDefault Value
urlProvide the url of the logo""
namePass any name or string value, so that it will display the avatar with initials.""
initialsLetterCountNumber of initials to appear in the avatar if the name is provided instead of url2
sizeSpecify the size of the avatar."md:h-10 md:w-10 h-6 w-6"
classNameImgSpecify the style classes needed avatar image"inline-block rounded-full"
classNameInitialsTo provide external classnames for the initials styling. Should be a string."md:text-xl text-xs md:font-medium font-light leading-none text-white"
classNameInitialsWrapperTo provide external classnames for the initials wrapper styling. Should be a string."inline-flex rounded-full items-center justify-center bg-gray-500"
styleCustom css styles which are not the part of tailwind.""
Try Miru

Read it once. Run it for real.

The docs explain the workflow. Miru gives you the actual timer, invoice, reports, and payment flow without another pile of tools.

Overview
Miru dashboard in a light theme
Workspace Miru
Start Tracking Free