Skip to content

Avatar

Representation of entity
import { Avatar } from 'degen'
name
type
default
address
string
-
as
"img" | ComponentType<{}>
img
ensAvatarHook
EnsAvatarHook
-
label*
Required
string
-
noBorder
boolean
-
placeholder
boolean
-
shape
"circle" | "square"
circle
size
ConditionalStyle<Values<MapLeafNodes<{ '0px': string; '1px': string; '2px': string; '4px': string; '6px': string; '8px': string; '10px': string; '12px': string; '14px': string; '16px': string; '20px': string; '24px': string; '28px': string; '32px': string; '36px': string; ... 31 more ...; none: string; }, CSSVarFunc...
48px
src
string
-

A placeholder can be shown by setting the placeholder prop to true. The color is determined by the (optional) address prompt. It will default to blue. The placeholder will also be shown if the src is invalid and can not be loaded.

By default, there is a light border around the edge to define image edges on similarly colored backgrounds. This can be disabled by using the noBorder prop.

You can supply a hook to resolve an ENS avatar from an address if your app interfaces with the ethereum network

If you are using Next.js and configured next/image appropriately, you can pass it in with the as prop.