User
An avatar with a name and a description, optionally a link.
Examples
Sizes, link and vertical
Razor
<div class="flex flex-wrap items-center gap-8">
<KlyUser Name="Ada Lovelace" Description="Mathematician" />
<KlyUser Name="Grace Hopper" Description="Rear admiral" Size="KlySize.Lg" Href="/docs" />
<KlyUser Name="Alan Turing" Description="Computer scientist" Orientation="KlyOrientation.Vertical" Size="KlySize.Xl" />
</div>Badge, contacts and a person icon
A user takes a Badge and Contacts (a link or a copy button each), and shows a person icon without a name and a picture. KlyAvatarGroup puts the description and badge of each person in its tooltips.
Razor
<div class="grid w-full gap-6 sm:grid-cols-2">
<KlyUser Name="Ada Lovelace" Description="Analyst" AvatarColor="KlyColor.Secondary" Badge="@(new KlyBadgeItem("Admin") { Color = KlyColor.Primary })"
Contacts="@(new[] { new KlyContactItem("ada@example.com") { Icon = "envelope", Href = "mailto:ada@example.com" }, new KlyContactItem("+44 20 7946 0000") { Icon = "phone" } })" />
<KlyUser Description="No name and no picture shows a person icon" />
<KlyAvatarGroup Max="3" Items="@(new[]
{
new KlyAvatarItem(Alt: "Ada Lovelace") { Description = "Analyst", Badge = new KlyBadgeItem("Admin") },
new KlyAvatarItem(Alt: "Grace Hopper") { Description = "Engineer", Color = KlyColor.Info },
new KlyAvatarItem(Alt: "Alan Turing"),
new KlyAvatarItem(Alt: "Edsger Dijkstra"),
})" />
</div>API
KlyUser
Avatar with a name and a description, optionally linked.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
AvatarColor |
KlyColor? |
A color that tints the initials avatar. Values: primary, secondary, success, info, warning, error, neutral. |
|
AvatarSrc |
string |
Address of the avatar picture. | |
Badge |
KlyBadgeItem |
A badge shown at the end of the row. | |
Class |
string |
Classes added to the root element, merged last so they win over the theme. | |
Contacts |
IReadOnlyList |
Contact lines under the user, each with an optional icon, link and copy button. They sit outside the link of Href . The copy buttons are disabled until the page is interactive. | |
Description |
string |
Text under the name, such as a role or an email address. | |
Href |
string |
Makes the whole user a link. | |
Name |
string |
Name of the person or entity. | |
Orientation |
KlyOrientation |
KlyOrientation. |
Whether the name sits beside the avatar ( Horizontal ) or under it ( Vertical ). Values: Horizontal, Vertical. |
ShowAvatar |
bool |
true |
Shows the avatar: the image, else the initials of Name . |
Size |
KlySize |
KlySize. |
Size of the user, from Xs to Xl . When not set, Size applies, else the default of the component. Values: Xs, Sm, Md, Lg, Xl. |
Target |
KlyLinkTarget? |
The target attribute of the link, such as Blank . It applies when Href is set. | |
Ui |
UserUi |
Per-instance class overrides of the slots of the user, see UserUi . They are merged after the theme and the Class parameter wins on the root slot. |
Slots
| Name | Type | Description |
|---|---|---|
AvatarIcon |
RenderFragment |
Icon of the avatar when there is no picture, as markup such as a KlyIcon . Without a picture and a Name , a person icon is shown. Without a picture and a Name , a person icon is shown. |
Ui slots
Ui takes a UserUi with one class string per slot, merged after the theme.
| Slot | Styles |
|---|---|
Root |
Classes merged into the root slot of KlyUser , after the theme and the app configuration. |
Avatar |
Classes merged into the avatar slot of KlyUser , after the theme and the app configuration. |
Wrapper |
Classes merged into the wrapper slot of KlyUser , after the theme and the app configuration. |
Name |
Classes merged into the name slot of KlyUser , after the theme and the app configuration. |
Description |
Classes merged into the description slot of KlyUser , after the theme and the app configuration. |
Stack |
Classes merged into the stack slot of KlyUser , after the theme and the app configuration. |
Badge |
Classes merged into the badge slot of KlyUser , after the theme and the app configuration. |
Contacts |
Classes merged into the contacts slot of KlyUser , after the theme and the app configuration. |
Contact |
Classes merged into the contact slot of KlyUser , after the theme and the app configuration. |
ContactBody |
Classes merged into the contactBody slot of KlyUser , after the theme and the app configuration. |
ContactIcon |
Classes merged into the contactIcon slot of KlyUser , after the theme and the app configuration. |
ContactLink |
Classes merged into the contactLink slot of KlyUser , after the theme and the app configuration. |
ContactText |
Classes merged into the contactText slot of KlyUser , after the theme and the app configuration. |
Copy |
Classes merged into the copy slot of KlyUser , after the theme and the app configuration. |
CopyIcon |
Classes merged into the copyIcon slot of KlyUser , after the theme and the app configuration. |