Renders an avatar component with optional file upload.

Parameters:
NameTypeAttributesDefaultDescription
childrenReact.ReactNode | Array.<React.ReactNode><optional>

React element children

customAttributesRecord.<string, any><optional>

Custom attributes for the component

customClassesstring | Array.<string> | Record.<string, boolean><optional>

Custom classes for the component

droplistAttributesRecord.<string, any><optional>

Custom attributes for the droplist component

droplistClassesstring | Array.<string> | Record.<string, boolean><optional>

Custom classes for the droplist component

hasActionsboolean<optional>
false

Whether to show the actions droplist

hasBorderboolean<optional>
false

Whether the avatar has a border

hasUploadboolean<optional>
false

Whether to show the file upload

hideInitialsboolean<optional>
false

Whether to hide the initials

hideLogoboolean<optional>
false

Whether to hide the logo

hideNoImageIconboolean<optional>
false

Whether to show the no image icon in the background.

i18nRecord.<string, any><optional>

The i18n strings for the component

idstring<optional>
''

The ID of the component

imageFilestring<optional>
''

The image file for the avatar

initialsstring<optional>
''

The initials for the avatar

LogoReact.ComponentType<optional>
null

The logo component

noImageIconstring<optional>
'user'

The icon to show when no image is present

noImageIconPrefixstring<optional>
'gravity-component-icon'

The icon prefix

selectButtonAttributesRecord.<string, any><optional>

Custom attributes for the select button

size'2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'<optional>
'lg'

The size of the avatar

spacingstring | number | Array.<string> | Record.<string, any><optional>
''

The spacing for the component

uploadButtonAttributesRecord.<string, any><optional>

Custom attributes for the upload button

refReact.RefObject.<HTMLElement> | null

Ref to the component

Since
  • 5.4.6
Returns:

The avatar component.

Type: 
JSX.Element
Example
import Avatar from '@gravityforms/components/react/admin/modules/Avatar';

return (
    <Avatar>
        { 'children' }
    </Avatar>
);