Avatar API

API documentation for Avatar component

Avatar#

Props#

Defines valid properties in Avatar component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: AvatarInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: AvatarInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<AvatarPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: AvatarInstance) => ReactNode)
null
The children to render.
size"large" | "normal" | "xlarge"
normal
Defines the size of the avatar.
shape"circle" | "square"
square
Defines the shape of the avatar.
delayDurationnumber
null
The delay duration of the avatar.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

State#

Defines valid state in Avatar component.

nametypedefaultdescription
loadboolean
null
Whether the avatar's image is loading or not.

Exposes#

Defines the methods and properties exposed by Avatar component.

nametypedefaultdescription
stateuseAvatarState
null
The state of the useAvatar.
handleImageLoad(src?: string) => void
null
The method to handle image load.
handleImageUnload() => void
null
The method to handle image unload.

Interfaces#

Defines passthrough(pt) options of Avatar component.

nametypedefaultdescription
rootAvatarPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the root's DOM element.
fallbackAvatarPassThroughType<HTMLAttributes<HTMLSpanElement>>
null
Used to pass attributes to the fallback's DOM element.
imageAvatarPassThroughType<HTMLAttributes<HTMLImageElement>>
null
Used to pass attributes to the image's DOM element.

Types#

Instance of Avatar component.

values
ComponentInstance<AvatarProps, AvatarState, AvatarExposes>

AvatarFallback#

Props#

Defines valid properties in AvatarFallback component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: AvatarFallbackInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: AvatarFallbackInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<AvatarFallbackPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: AvatarFallbackInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by AvatarFallback component.

nametypedefaultdescription
avatarAvatarInstance
null
The Avatar component instance.

Interfaces#

Defines passthrough(pt) options of AvatarFallback component.

nametypedefaultdescription
rootAvatarFallbackPassThroughType<HTMLAttributes<HTMLSpanElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of AvatarFallback component.

values
ComponentInstance<AvatarFallbackProps, AvatarFallbackState, AvatarFallbackExposes>

AvatarImage#

Props#

Defines valid properties in AvatarImage component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: AvatarImageInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: AvatarImageInstance) => string)
null
The class name to apply to the component.
asReactNode
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<AvatarImagePassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: AvatarImageInstance) => ReactNode)
null
The children to render.
srcstring
null
Specifies the path to the image to display.
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by AvatarImage component.

nametypedefaultdescription
avatarAvatarInstance
null
The Avatar component instance.

Interfaces#

Defines passthrough(pt) options of AvatarImage component.

nametypedefaultdescription
rootAvatarImagePassThroughType<HTMLAttributes<HTMLImageElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of AvatarImage component.

values
ComponentInstance<AvatarImageProps, AvatarImageState, AvatarImageExposes>

AvatarGroup#

Props#

Defines valid properties in AvatarGroup component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: AvatarGroupInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: AvatarGroupInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<AvatarGroupPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: AvatarGroupInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Interfaces#

Defines passthrough(pt) options of AvatarGroup component.

nametypedefaultdescription
rootAvatarGroupPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of AvatarGroup component.

values
ComponentInstance<AvatarGroupProps, AvatarGroupState, AvatarGroupExposes>

useAvatar#

Props#

Defines valid properties in useAvatar.

nametypedefaultdescription
delayDurationnumber
null
The delay duration of the avatar.

State#

Defines valid state in useAvatar.

nametypedefaultdescription
loadboolean
null
Whether the avatar's image is loading or not.

Exposes#

Defines the methods and properties exposed by useAvatar.

nametypedefaultdescription
stateuseAvatarState
null
The state of the useAvatar.
handleImageLoad(src?: string) => void
null
The method to handle image load.
handleImageUnload() => void
null
The method to handle image unload.

Events#

Types#

Instance of useAvatar headless.

values
HeadlessInstance<useAvatarProps, useAvatarState, useAvatarExposes>