Avatar
Description
A component that represents a user
Avatars are used to represent users, teams, or entities in the system. They can display images, initials, and presence indicators.
The Persona component builds upon Avatar by adding textual information like name, role, and status, making it ideal for profile cards or contact lists.
Samples
Avatar Sizes and Presence
Avatars support various sizes from XSmall to XLarge and optional presence states.
Initials Fallback
When no image is provided, initials are displayed with a generated background color derived from a deterministic hash of the initials.
Persona Component
Personas combine an avatar with descriptive text.
API reference
public enum AvatarSizePredefined size presets used by the Avatar component.
- Namespace
- Tesserae
public enum AvatarPresence- Namespace
- Tesserae
public sealed class Avatar : ComponentBase<Avatar, HTMLElement>- Namespace
- Tesserae
- Inheritance
- ComponentBase<Avatar, HTMLElement> → Avatar
Constructors
| Name | Description |
|---|---|
| Avatar | Initializes a new instance of this class. |
Properties
| Name | Description |
|---|---|
| ImageUrl | Gets or sets the image url. |
| Initials | Gets or sets the initials. |
| SizeValue | Gets or sets the size value. |
| PresenceState | Gets or sets the presence state. |
Methods
| Name | Description |
|---|---|
| SetImage | Sets the image of the component. |
| SetInitials | Sets the initials of the component. |
| Size | Gets or sets the size of the component. |
| Presence | Configures the component to presence. |
| Background | Gets or sets the CSS background of the component. |
| Foreground | Gets or sets the CSS color (foreground) of the component. |
| GradientForHue | Builds the two-stop gradient an avatar is filled with, from a hue in degrees. Shared so that anything else standing in for an avatar - a PixelAvatarBadge, say - looks like it came out of the same set. |
| GradientForColor | Builds the gradient for a color, using its hue. See GradientForHue. |
| Render | Renders the component's root HTML element. |
public Avatar SetInitials(string initials)Sets the initials of the component.
public Avatar Presence(AvatarPresence presence)Configures the component to presence.
public Avatar Background(string color)Gets or sets the CSS background of the component.
public Avatar Foreground(string color)Gets or sets the CSS color (foreground) of the component.
public static string GradientForHue(int hue)Builds the two-stop gradient an avatar is filled with, from a hue in degrees. Shared so that anything else standing in for an avatar - a PixelAvatarBadge, say - looks like it came out of the same set.
public static string GradientForColor(Color color)Builds the gradient for a color, using its hue. See GradientForHue.
public sealed class Persona : ComponentBase<Persona, HTMLElement>- Namespace
- Tesserae
- Inheritance
- ComponentBase<Persona, HTMLElement> → Persona
Constructors
| Name | Description |
|---|---|
| Persona | Initializes a new instance of this class. |
Methods
| Name | Description |
|---|---|
| SetAvatar | Sets the avatar of the component. |
| SetName | Sets the name of the component. |
| SetSecondaryText | Sets the secondary text of the component. |
| SetTertiaryText | Sets the tertiary text of the component. |
| Compact | Renders the component in a compact form. |
| Render | Renders the component's root HTML element. |
public Persona SetSecondaryText(string text)Sets the secondary text of the component.
public Persona SetTertiaryText(string text)Sets the tertiary text of the component.
public Persona Compact(bool value = true)Renders the component in a compact form.