> Markdown version of [Styling](https://vaadin.com/docs/next/components/avatar/styling). Section index: [llms.txt](https://vaadin.com/docs/next/components/llms.txt)

# Avatar Styling

## <a id="style-variants"></a>Style Variants

Avatar and Avatar Group support the following style variants:

| Variant   | Description                                            | Supported by |
| --------- | ------------------------------------------------------ | ------------ |
| `reverse` | Reverses the stacking order of avatars in Avatar Group | Aura, Lumo   |
| `large`   | Large avatar size                                      | Aura, Lumo   |
| `small`   | Small avatar size                                      | Aura, Lumo   |
| `xlarge`  | Extra large avatar size                                | Aura, Lumo   |
| `xsmall`  | Extra small avatar size                                | Aura, Lumo   |
| `filled`  | Uses a solid background color for avatars              | Aura         |

### <a id="size-variants"></a>Size Variants

Avatar has four available size variants:

**Lit** — `avatar-sizes.ts`

```html
<vaadin-avatar
  .name="${`${this.person?.firstName} ${this.person?.lastName}`}"
  theme="xlarge"
></vaadin-avatar>

<vaadin-avatar
  .name="${`${this.person?.firstName} ${this.person?.lastName}`}"
  theme="large"
></vaadin-avatar>

<vaadin-avatar
  .name="${`${this.person?.firstName} ${this.person?.lastName}`}"
  theme="small"
></vaadin-avatar>

<vaadin-avatar
  .name="${`${this.person?.firstName} ${this.person?.lastName}`}"
  theme="xsmall"
></vaadin-avatar>
```

**Flow** — `AvatarSizes.java`

```java
Avatar xl = new Avatar(name);
xl.addThemeVariants(AvatarVariant.XLARGE);

Avatar l = new Avatar(name);
l.addThemeVariants(AvatarVariant.LARGE);

Avatar s = new Avatar(name);
s.addThemeVariants(AvatarVariant.SMALL);

Avatar xs = new Avatar(name);
xs.addThemeVariants(AvatarVariant.XSMALL);
```

**React** — `avatar-sizes.tsx`

```tsx
<Avatar name={`${person.value?.firstName} ${person.value?.lastName}`} theme="xlarge" />

<Avatar name={`${person.value?.firstName} ${person.value?.lastName}`} theme="large" />

<Avatar name={`${person.value?.firstName} ${person.value?.lastName}`} theme="small" />

<Avatar name={`${person.value?.firstName} ${person.value?.lastName}`} theme="xsmall" />
```

Size variants should be used only in special cases. Use the `--vaadin-avatar-size` CSS property to change the default Avatar size.

## <a id="style-properties"></a>Style Properties

The following style properties can be used in CSS stylesheets to customize the appearance of this component.

To apply values to these properties globally in your application UI, place them in a CSS block using the `html {…​}` selector. See [Component Style Properties](https://vaadin.com/docs/next/styling/styling-components.md#component-style-properties) for more information on style properties.

### <a id="common-properties"></a>Common Properties

| Property                        | Supported by |
| ------------------------------- | ------------ |
| `--vaadin-avatar-background`    | Aura, Lumo   |
| `--vaadin-avatar-border-width`  | Aura, Lumo   |
| `--vaadin-avatar-text-color`    | Aura         |
| `--vaadin-avatar-border-color`  | Aura         |
| `--vaadin-avatar-group-overlap` | Aura, Lumo   |
| `--vaadin-avatar-group-gap`     | Aura, Lumo   |
| `--vaadin-avatar-size`          | Aura, Lumo   |

### <a id="overlay"></a>Overlay

| Property                         | Supported by |
| -------------------------------- | ------------ |
| `--vaadin-item-overlay-padding`  | Aura         |
| `--vaadin-overlay-background`    | Aura         |
| `--vaadin-overlay-border-color`  | Aura         |
| `--vaadin-overlay-border-radius` | Aura         |
| `--vaadin-overlay-border-width`  | Aura         |
| `--vaadin-overlay-shadow`        | Aura         |

### <a id="overlay-items"></a>Overlay Items

| Property                        | Supported by |
| ------------------------------- | ------------ |
| `--vaadin-item-border-radius`   | Aura         |
| `--vaadin-item-checkmark-color` | Aura         |
| `--vaadin-icon-size`            | Aura         |
| `--vaadin-item-gap`             | Aura         |
| `--vaadin-item-height`          | Aura         |
| `--vaadin-item-padding`         | Aura         |
| `--vaadin-focus-ring-width`     | Aura, Lumo   |
| `--vaadin-focus-ring-color`     | Aura, Lumo   |

### <a id="animation"></a>Animation (since V25.3)

The overlay has a built-in opening and closing animation, which is disabled until an animation duration is set. The `closed` properties define the state that the overlay animates from when it opens, and to when it closes. The Aura theme sets these properties for some components. Lumo has its own overlay animations, which these properties don’t affect.

While an animation runs, the component has the `opening` or `closing` state attribute, so separate values can be applied to each direction. The backdrop always fades, and only the opacity is animated when the user prefers reduced motion.

| Property                                     | Value syntax                   | Initial value |
| -------------------------------------------- | ------------------------------ | ------------- |
| `--vaadin-overlay-animation-delay`           | `<time>`                       | `0s`          |
| `--vaadin-overlay-animation-duration`        | `<time>`                       | `0s`          |
| `--vaadin-overlay-animation-timing-function` | `<easing-function>`            | `ease`        |
| `--vaadin-overlay-opacity-closed`            | `<number>`                     | `0`           |
| `--vaadin-overlay-scale-closed`              | `<number>` or `<percentage>`   | `1`           |
| `--vaadin-overlay-transform-closed`          | `<transform-list>`             | `none`        |
| `--vaadin-overlay-translate-closed`          | `<length>+` or `<percentage>+` | `0px`         |

### <a id="user-color-properties"></a>User Color Properties

| Property                | Supported by |
| ----------------------- | ------------ |
| `--vaadin-user-color-0` | Aura, Lumo   |
| `--vaadin-user-color-1` | Aura, Lumo   |
| `--vaadin-user-color-2` | Aura, Lumo   |
| `--vaadin-user-color-3` | Aura, Lumo   |
| `--vaadin-user-color-4` | Aura, Lumo   |
| `--vaadin-user-color-5` | Aura, Lumo   |
| `--vaadin-user-color-6` | Aura, Lumo   |
| `--vaadin-user-color-7` | Aura         |
| `--vaadin-user-color-8` | Aura         |
| `--vaadin-user-color-9` | Aura         |

## <a id="css-selectors"></a>CSS Selectors

The following CSS selectors can be used in stylesheets to target the various parts and states of the component. See the [Styling documentation](https://vaadin.com/docs/next/styling.md) for more details on how to style components.

> **Important: Not for Shadow DOM**
>
> These selectors should be used in `styles.css` or another stylesheet loaded with the `@StyleSheet` annotation or the `@import` CSS rule. **They do not work in the shadow DOM of Vaadin components**, such as in stylesheets in the `components` sub-folder or loaded with the `@CssImport` annotation’s `themeFor` property.

---

### <a id="avatar"></a>Avatar

- Root element

  `vaadin-avatar`

- Hovered avatar

  `vaadin-avatar:hover`

- Focused avatar

  `vaadin-avatar[focused]`

- Keyboard focused avatar

  `vaadin-avatar[focus-ring]`

- Avatar with tooltip

  `vaadin-avatar[has-tooltip]`

- Avatar with color index

  `vaadin-avatar[has-color-index]`

- Overflow avatar

  `vaadin-avatar[slot="overflow"]`

- Expanded overflow avatar

  `vaadin-avatar[aria-expanded="true"]`

- Avatar icon

  `vaadin-avatar::part(icon)`

- Avatar abbreviation

  `vaadin-avatar::part(abbr)`

### <a id="avatar-group"></a>Avatar Group

- Root element

  `vaadin-avatar-group`

- Avatar in group

  `vaadin-avatar-group > vaadin-avatar`

### <a id="overlay-2"></a>Overlay

- Overlay background

  `vaadin-avatar-group::part(overlay)`

- Overlay content wrapper

  `vaadin-avatar-group::part(content)`

- Menu inside overlay

  `vaadin-avatar-group-menu`

- Item element

  `vaadin-avatar-group-menu-item`

- Hovered item

  `vaadin-avatar-group-menu-item:hover`

- Focused item

  `vaadin-avatar-group-menu-item[focused]`

- Keyboard focused item

  `vaadin-avatar-group-menu-item[focus-ring]`

- Item content wrapper

  `vaadin-avatar-group-menu-item::part(content)`

- Item avatar

  `vaadin-avatar-group-menu-item > vaadin-avatar`
