Documentation Index
Fetch the complete documentation index at: https://mintlify.com/theopenlane/openlane-ui/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The Avatar component displays a user profile image with automatic fallback to initials or placeholder content. It’s built on Radix UI’s Avatar primitive.Import
Usage
Components
Avatar
The root container component.Size variant of the avatar.
small: 20px × 20pxmedium: 40px × 40pxlarge: 56px × 56pxextra-large: 72px × 72px
Additional CSS classes to apply.
AvatarImage
The image element, automatically handles loading states.Image source URL.
Alternative text for the image.
Additional CSS classes to apply.
AvatarFallback
Displayed while the image is loading or if it fails to load.Content to display as fallback (typically user initials).
Additional CSS classes to apply.
Examples
With Image
Without Image (Fallback Only)
Different Sizes
User Initials Helper
In a User Card
Custom Styling
Styling Details
The Avatar component uses the following base styles:Avatar Root
relative flex- Flex containerh-8 w-8- Default size (32px, overridden by variants)shrink-0- Prevents shrinking in flex layoutsoverflow-hidden- Clips image to containerrounded-full- Circular shapebg-avatar-transparent- Transparent background
AvatarImage
aspect-square- 1:1 aspect ratioh-full w-full- Fills container
AvatarFallback
uppercase- Uppercase textflex h-full w-full items-center justify-center- Centers contentbg-avatar- Avatar background colortext-button-text- Text colorrounded-full- Circular shape
Accessibility
- Always provide an
altattribute forAvatarImage - Fallback text is automatically uppercase for consistency
- The component uses Radix UI primitives for proper accessibility
Sources
- Avatar Component:
/home/daytona/workspace/source/packages/ui/src/avatar/avatar.tsx - Avatar Styles:
/home/daytona/workspace/source/packages/ui/src/avatar/avatar.styles.tsx