Class RadzenGravatar
A Gravatar avatar component that displays a user's profile image from Gravatar.com based on their email address. RadzenGravatar automatically fetches and displays the globally recognized avatar associated with an email. Gravatar (Globally Recognized Avatar) is a service that associates profile images with email addresses. Fetches avatar using MD5 hash of email address, requires no storage or management of avatar images, shows default retro-style avatar if email has no Gravatar, features configurable pixel dimensions, and uses secure.gravatar.com to retrieve images. Generates a Gravatar URL from the email and displays it as an image. If the email doesn't have a Gravatar account, a retro-style default avatar is shown. Commonly used in user profiles, comment sections, or anywhere user identity is displayed.
Inherited Members
Namespace: Radzen.Blazor
Assembly: Radzen.Blazor.dll
Syntax
public class RadzenGravatar : RadzenComponent, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
Examples
Basic Gravatar:
<RadzenGravatar Email="user@example.com" />
Large Gravatar with custom alternate text:
<RadzenGravatar Email=@currentUser.Email Size="80" AlternateText=@currentUser.Name />
Gravatar in profile header:
<RadzenStack Orientation="Orientation.Horizontal" Gap="1rem" AlignItems="AlignItems.Center">
<RadzenGravatar Email=@user.Email Size="64" />
<RadzenText TextStyle="TextStyle.H5">@user.Name</RadzenText>
</RadzenStack>
Constructors
RadzenGravatar()
A Gravatar avatar component that displays a user's profile image from Gravatar.com based on their email address. RadzenGravatar automatically fetches and displays the globally recognized avatar associated with an email. Gravatar (Globally Recognized Avatar) is a service that associates profile images with email addresses. Fetches avatar using MD5 hash of email address, requires no storage or management of avatar images, shows default retro-style avatar if email has no Gravatar, features configurable pixel dimensions, and uses secure.gravatar.com to retrieve images. Generates a Gravatar URL from the email and displays it as an image. If the email doesn't have a Gravatar account, a retro-style default avatar is shown. Commonly used in user profiles, comment sections, or anywhere user identity is displayed.
Declaration
public RadzenGravatar()
Examples
Basic Gravatar:
<RadzenGravatar Email="user@example.com" />
Large Gravatar with custom alternate text:
<RadzenGravatar Email=@currentUser.Email Size="80" AlternateText=@currentUser.Name />
Gravatar in profile header:
<RadzenStack Orientation="Orientation.Horizontal" Gap="1rem" AlignItems="AlignItems.Center">
<RadzenGravatar Email=@user.Email Size="64" />
<RadzenText TextStyle="TextStyle.H5">@user.Name</RadzenText>
</RadzenStack>
Properties
AlternateText
Gets or sets the alternate text describing the avatar for accessibility. This text is read by screen readers and displayed if the image fails to load.
Declaration
[Parameter]
public string AlternateText { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The image alternate text. Default is "gravatar". |
Gets or sets the email address used to fetch the Gravatar image. The email is hashed (MD5) and used to query Gravatar.com for the associated profile image.
Declaration
[Parameter]
public string Email { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The email address. |
Size
Gets or sets the size of the avatar image in pixels (both width and height). Gravatar provides square images at various sizes.
Declaration
[Parameter]
public int Size { get; set; }
Property Value
| Type | Description |
|---|---|
| int | The avatar size in pixels. Default is 36. |
Url
Gets gravatar URL.
Declaration
protected string Url { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
BuildRenderTree(RenderTreeBuilder)
A Gravatar avatar component that displays a user's profile image from Gravatar.com based on their email address. RadzenGravatar automatically fetches and displays the globally recognized avatar associated with an email. Gravatar (Globally Recognized Avatar) is a service that associates profile images with email addresses. Fetches avatar using MD5 hash of email address, requires no storage or management of avatar images, shows default retro-style avatar if email has no Gravatar, features configurable pixel dimensions, and uses secure.gravatar.com to retrieve images. Generates a Gravatar URL from the email and displays it as an image. If the email doesn't have a Gravatar account, a retro-style default avatar is shown. Commonly used in user profiles, comment sections, or anywhere user identity is displayed.
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
| Type | Name | Description |
|---|---|---|
| RenderTreeBuilder | __builder |
Overrides
GetComponentCssClass()
Gets the component CSS class.
Declaration
protected override string GetComponentCssClass()
Returns
| Type | Description |
|---|---|
| string |