Skip to content
Versions v3 v2 v1

Avatar

An avatar is a visual used to represent a user. It may contain an image or a placeholder graphic.

Installation

We recommend loading elements via a CDN such as JSPM and using an import map to manage your dependencies.

For more information on import maps and how to use them, see the import map reference on MDN Web Docs.

If you are using node and NPM, you can install this component using npm:

npm install @patternfly/elements

Then import this component into your project by using a bare module specifier:

import '@patternfly/elements/pf-avatar/pf-avatar.js';

Please Note You should either load elements via a CDN or install them locally through NPM. Do not do both.

Overview

Installation

npm install @patternfly/elements

Usage

View HTML Source
<pf-avatar alt="Eleanore Stillwagon"></pf-avatar>
<pf-avatar alt="Libbie Koscinski" size="md"></pf-avatar>
<pf-avatar alt="Blanca Rohloff"></pf-avatar>
<pf-avatar alt="Edwardo Lindsey" src="https://clayto.com/2014/03/rgb-webgl-color-cube/colorcube.jpg"></pf-avatar>

Slots

None

Attributes

size

Size of the Avatar

DOM Property
size
Type
'sm' | 'md' | 'lg' | 'xl'
Default
'sm'
border

Whether to display a border around the avatar

DOM Property
border
Type
'light' | 'dark' | undefined
Default
unknown
src

The URL to the user's custom avatar image.

DOM Property
src
Type
string | undefined
Default
unknown
alt

The alt text for the avatar image.

DOM Property
alt
Type
string | undefined
Default
'Avatar image'
dark

Whether or not the Avatar image is dark

DOM Property
dark
Type
boolean
Default
false

DOM Properties

None

Methods

None

Events

None

CSS Custom Properties

None

CSS Shadow Parts

None

© 2018-2024 Red Hat, Inc. Deploys by Netlify