Avatars

Svelte Component

Display user avatars with an image or initials.

Examples

avatar

Getting Started

Using Images

Display an image source cropped into the shape.

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

Using Initials

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

html
<Avatar initials="JD" />

Interactive Border

Apply the following styles using the border and cursor properties.

html
<Avatar ... border="border-4 border-surface-300-600-token hover:!border-primary-500" cursor="cursor-pointer" />

Applying Filters

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

typescript
import { filter, Apollo } from '@skeletonlabs/skeleton';

Via Filter Action

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" />

Via Style Attribute

html
<Avatar src="https://i.pravatar.cc/" style="filter: url({'#Apollo'})" />