Avatars

Display user avatars with an image or initials.

javascript
import { Avatar } from '@brainandbones/skeleton';
avatar

Usage

Image

Display an image source cropped into the shape.

html
<Avatar src="https://i.pravatar.cc/" />

Initials

Display up to two text characters. (ex: Jane Doe would be JD)

html
<Avatar initials="JD" />

Using Filters

See Filters to learn how to import and configure the filters action and SVG filter components.

ts
import { filter, Apollo, /* ... */ } from '@brainandbones/skeleton';

Import the filter action reference using action and set actionParams to the desired filter id.

html
<Avatar src="https://i.pravatar.cc/" action={filter} actionParams="Apollo" />

Properties

Prop Type Default Description
backgroundstringbg-surface-500Provide classes to set background styles.
widthstringw-12Provide classes to set avatar width.
borderstring-Provide classes to set border styles.
roundedstringrounded-fullProvide classes to set rounded style.
shadowstring-Provide classes to set shadow styles.
cursorstring-Provide classes to set cursor styles.

Image

Prop Type Default Values Description
srcstring--Set image source value.
altstring--Set image alt text value for accessability.
actionstring-(Svelte action)Provide an Svelte action reference, such as filter.
actionParamsstring-(filter ID)Provide Svelte action params, such as Apollo.

Initials

Prop Type Default Description
initialsstringABProvide up to two text characters.
fillstringfill-whiteProvide classes to set the text fill color.