Appearance
The Avatar allows you to set different styles based on its content.
For a live example, refer to the Appearance Demo of the Avatar.
Type
The Type can be configured via the AvatarType enumeration. The available AvatarType values are:
Text— By passing a string that will be rendered as text (initials).Image— By passing animgelement as child element of the Avatar.Icon— By passing aniconto the Avatar component.
When not explicitly set, the type defaults to
Text.
The following example demonstrates the Type option of the Avatar:
@(Html.Kendo().Avatar()
.Name("avatar")
.Type(AvatarType.Text)
.Text("IMG")
)
All of the types can be rendered in a different shape by setting the Rounded property.
Rounded
The Rounded property can be configured via the Rounded enumeration. The available values are:
Full— Renders a circle shape avatar.Small— Renders an avatar with small border radius.Medium— Renders an avatar with medium border radius.Large— Renders an avatar with large border radius.
When not explicitly set, the applied theme controls the default border radius.
The
Nonevalue is deprecated. Use custom CSS instead.
The following example demonstrates the Rounded option of the Avatar:
@(Html.Kendo().Avatar()
.Name("avatar")
.Text("IMG")
.Rounded(Rounded.Large)
)
Theme Color
The Avatar allows you to specify predefined theme colors.
The available ThemeColor values are:
Primary—Applies coloring based on the primary theme color.Base- Applies base theme color.Secondary— Applies coloring based on the secondary theme color.Tertiary— Applies coloring based on the tertiary theme color.Inherit— Applies the inherited coloring value.Info— Applies coloring based on the info theme color.Success— Applies coloring based on the success theme color.Warning— Applies coloring based on the warning theme color.Error— Applies coloring based on the error theme color.Dark— Applies coloring based on the dark theme color.Light— Applies coloring based on the light theme color.Inverse— Applies coloring based on the inverted theme color.
When not explicitly set, the applied theme controls the default theme color.
@(Html.Kendo().Avatar()
.Name("avatar")
.Type(AvatarType.Icon)
.Icon("user")
.ThemeColor(ThemeColor.Primary)
)
Size
The Avatar allows you to set predefined or custom sizes. The Size property can be configured via the ComponentSizeenumeration. The available values are:
SmallMediumLarge
When not explicitly set, the applied theme controls the default size.
The
Nonevalue is deprecated. Use custom CSS instead.
@(Html.Kendo().Avatar()
.Name("avatar")
.Type(AvatarType.Text)
.Text("JS")
.Size(ComponentSize.Large)
)
FillMode
The Avatar enables you to set styling options and create solid or outline avatars by setting the AvatarFillMode. The available AvatarFillMode values are:
SolidOutline
When not explicitly set, the applied theme controls the default fill mode.
The
Nonevalue is deprecated. Use custom CSS instead.
@(Html.Kendo().Avatar()
.Name("avatar")
.Type(AvatarType.Text)
.Text("JS")
.FillMode(AvatarFillMode.Outline)
)
Border
The Avatar allows you to specify whether or not to render an additional border around its content by using the Border property. By default, the border is set to false.
@(Html.Kendo().Avatar()
.Name("avatar")
.Type(AvatarType.Text)
.Text("MJ")
.Border(true)
)