Blazor playground

Nova v3.38.0

Preview

Blazor

nv-avatar migration

Moving from the size flags, text and url to size, initials and src.

← nv-avatar

Migration Guide for nv-avatar

In the latest version of the nv-avatar component, we've made several important changes to the properties to improve usability and consistency. Below is a guide to help you update your existing avatars from version 2 to version 3.

Deprecations#

1. prop large, medium, small, xSmall, xLarge -> size#

The size properties have been consolidated into a single size property with an enum type.

Old Usage:

razor<NvAvatar Large="true"></NvAvatar>
<NvAvatar Medium="true"></NvAvatar>
<NvAvatar Small="true"></NvAvatar>
<NvAvatar Xlarge="true"></NvAvatar>
<NvAvatar Xsmall="true"></NvAvatar>

New Usage:

razor<NvAvatar Size="NvAvatar.SizeEnum.lg"></NvAvatar>
<NvAvatar Size="NvAvatar.SizeEnum.md"></NvAvatar>
<NvAvatar Size="NvAvatar.SizeEnum.sm"></NvAvatar>
<NvAvatar Size="NvAvatar.SizeEnum.xl"></NvAvatar>
<NvAvatar Size="NvAvatar.SizeEnum.xs"></NvAvatar>

2. prop rounded, square removed#

The shape properties have been deprecated. The new architecture does not support these properties directly; instead, use CSS classes as needed.

Old Usage:

razor<NvAvatar Rounded="true"></NvAvatar>
<NvAvatar Square="true"></NvAvatar>

3. prop text -> initials#

The text property has been renamed to initials.

Old Usage:

razor<NvAvatar Text="AB"></NvAvatar>

New Usage:

razor<NvAvatar Initials="AB"></NvAvatar>

4. prop url -> src#

The url property has been renamed to src.

Old Usage:

razor<NvAvatar Url="image_url"></NvAvatar>

New Usage:

razor<NvAvatar Src="image_url"></NvAvatar>

Breaking Changes#

1. prop icon -> slot#

The icon property has been removed. The new architecture does not support this property, use a slot instead.

Old Usage:

razor<NvAvatar Icon="iconName"></NvAvatar>

New Usage:

razor<NvAvatar>
  <IconSlot><NvIcon Name="iconName"></NvIcon></IconSlot>
</NvAvatar>

2. prop color no longer has semantic colors#

You can no longer set the color with values like primary, secondary, success, error and neutral. Instead use numeric values as a string between 0 and 4.

Old Usage:

razor<NvAvatar Color="primary"></NvAvatar>
<NvAvatar Color="secondary"></NvAvatar>
<NvAvatar Color="success"></NvAvatar>
<NvAvatar Color="error"></NvAvatar>
<NvAvatar Color="neutral"></NvAvatar>

New Usage:

razor<NvAvatar Color="0"></NvAvatar>
<NvAvatar Color="1"></NvAvatar>
<NvAvatar Color="2"></NvAvatar>
<NvAvatar Color="3"></NvAvatar>
<NvAvatar Color="4"></NvAvatar>

New Properties#

1. alt: Provides an alternative text description for the avatar image.#

New Usage:

razor<NvAvatar Alt="User's profile picture"></NvAvatar>