runway

Runway

Avatar

A flexible avatar component that displays either an image or a fallback letter. Includes optional status indicators.


User Example
D
Broken

The Avatar component displays a user’s profile image. If the image fails to load or isn’t provided, it automatically falls back to a letter. It supports various sizes, shapes, colors, and status indicators.

For multiple avatars, see the AvatarList component.



Usage

javascript

1import Avatar from '@/components/atoms/avatar';
2
3<Avatar src="/avatar1.png" alt="User Image"/>



Props

PropTypeDefaultDescription
srcstring-Image URL
altstring""Image alt text
letterstring-Letter to display
colorstring"gray"Avatar color (from tailwind.config)
borderRadiusstring"full"The tailwind-friendly rounding for corners (e.g. "md", "full", etc)
size"xs" | "sm" | "md" | "lg" | "xl""md"Avatar size
borderbooleantrueWhether to show a border
statusstring-A status indicator (e.g. 'online')
statusColorstring"green"Status color (from tailwind.config)
ringColorstring"gray"Border color when status is provided (from tailwind.config)
onClickfunction-Click handler
classNamestring""Additional Tailwind classes (overrides defaults if needed)
...propsobject-Additional props for the image element

Feel free to customize the status prop any way you like, such as 'online' or 'busy'.




Examples

1. Basic Image Avatar

Simply provide a src and alt prop. Optionally, style with other props.

User One
User Two

2. Letter

If you want a letter instead of an image, just provide the letter prop.

Z
Ava Jones

If the image is missing or broken, Avatar shows the the letter or the first character of the alt text.


3. Status Indicator

You can add a status indicator to show if the user is online, busy, etc.

Online User
O
Online User

Add a ringColor for more emphasis.