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.
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. |
| 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 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.
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.