User

Maintainer:
DakEnviy
GitHub
size
name
description
import {User} from '@gravity-ui/uikit';

This is a general component for displaying a user avatar with an info block. It uses the Avatar component to render the avatar. It can also accept a custom React node as an avatar.

Name and description

The User component has the name and description properties to display an info block.

Charles Darwincharles@mail.ai
<User avatar={{text: 'Charles Darwin', theme: 'brand'}} name="Charles Darwin" description="charles@mail.ai" size="l" />

Size

Use the size property to manage the User size. The default size is m. The possible values are 3xs, 2xs, xs, s, m, l, and xl.

This property is also provided to the internal Avatar component.

Charles Darwin
Charles Darwin
Charles Darwin
Charles Darwincharles@mail.ai
Charles Darwincharles@mail.ai
Charles Darwincharles@mail.ai
Charles Darwincharles@mail.ai
<User avatar={{text: 'Charles Darwin', theme: 'brand'}} name="Charles Darwin" description="charles@mail.ai" size="3xs" />
<User avatar={{text: 'Charles Darwin', theme: 'brand'}} name="Charles Darwin" description="charles@mail.ai" size="2xs" />
<User avatar={{text: 'Charles Darwin', theme: 'brand'}} name="Charles Darwin" description="charles@mail.ai" size="xs" />
<User avatar={{text: 'Charles Darwin', theme: 'brand'}} name="Charles Darwin" description="charles@mail.ai" size="s" />
<User avatar={{text: 'Charles Darwin', theme: 'brand'}} name="Charles Darwin" description="charles@mail.ai" size="m" />
<User avatar={{text: 'Charles Darwin', theme: 'brand'}} name="Charles Darwin" description="charles@mail.ai" size="l" />
<User avatar={{text: 'Charles Darwin', theme: 'brand'}} name="Charles Darwin" description="charles@mail.ai" size="xl" />

Properties

NameDescriptionTypeDefault
avatarUser avatarAvatarProps string React.ReactElement
nameUser nameReact.ReactNode
descriptionUser descriptionReact.ReactNode
sizeUser section size'3xs' '2xs' 'xs' 's' 'm' 'l' 'xl'm
aria-labelaria-label for the user sectionstring
aria-labelledbyaria-labelledby for the user sectionstring
aria-describedbyaria-describedby for the user sectionstring
aria-detailsaria-details for the user sectionstring
classNameCustom CSS class for the root elementstring
styleHTML style attributeReact.CSSProperties
qadata-qa HTML attribute, used for testingstring

CSS API

NameDescription
--g-user-avatar-offsetGap between avatar and text block
--g-user-name-font-weightName font weight
--g-user-name-font-sizeName font size
--g-user-name-line-heightName line height
--g-user-description-font-weightDescription font weight
--g-user-description-font-sizeDescription font size
--g-user-description-line-heightDescription line height