Avatar
A person's picture, or their initials.
The fallback shows while the picture loads, and in its place if it can’t. Avatars stay round
whatever a system’s radius; AvatarGroup overlaps several.
Dependencies
What it's built from and what's built from it in Base, read from the imports in its source.
| Uses | Textprimitive |
|---|---|
| Used by | Nothing yet. |
| Packages | @ui-sdk/core@0.1.0-beta.20@ui-sdk/react@0.1.0-beta.20 |
Installation
Set the project up for Base once first, as Getting started shows. Then add it with the CLI, or by hand.
With the CLI
Manually
Install its packages:
Add the components it uses first, listed under Dependencies.
Then copy the source:
API reference
Generated from Base's types. Props marked ours are added here; the rest come from the ui-sdk part it wraps. Every part also accepts its element's native attributes.
Avatar
A person's picture, or their initials while it loads or when there's none. Round in every system's radius.
- sizeours
Diameter: 24, 32 or 40 pixels.
Type "sm" | "md" | "lg" · Default md
- className
Type string | ((state: NoInfer<AvatarState>) => string)
- debug
Logs every state change with its reason to the console, in development builds.
Type boolean
- fallbackDelay
Type number
- onLoadingStatusChange
Runs when the image's loading status changes:
"loading"when it gets a source,"loaded","error", and"idle"when it leaves the page.details.reasonsays why, anddetails.eventis the image'sloadorerrorevent, or undefined when the status was known at once, like for a cached image.Type (status: AvatarLoadingStatus, details: ChangeDetails<AvatarLoadingStatusChangeReason>) => void
- render
Type RenderProp<NoInfer<AvatarState>>
- style
Type CSSProperties | ((state: NoInfer<AvatarState>) => CSSProperties)
AvatarFallback
Shown until the picture loads, and in its place if it can't: usually initials.
- children
Content, or a function of the part's state that returns it.
Type ReactNode | ((state: NoInfer<AvatarState>) => ReactNode)
- className
Class names, or a function of the part's state that returns them.
Type string | ((state: NoInfer<AvatarState>) => string)
- delay
How long to wait, in milliseconds, before showing the fallback, so a fast image appears without the fallback flashing first. Without one, the fallback shows at once, server markup included.
Type number · Default 0
- render
Renders your own element: one that receives the part's props, or a function of the props and the state.
Type RenderProp<NoInfer<AvatarState>>
- style
Styles, or a function of the part's state that returns them.
Type CSSProperties | ((state: NoInfer<AvatarState>) => CSSProperties)
AvatarGroup
Overlapping avatars, like the people on a document.
Takes the props of a native div.
AvatarImage
The picture. Give it the person's name as alt.
- children
Content, or a function of the part's state that returns it.
Type ReactNode | ((state: NoInfer<AvatarState>) => ReactNode)
- className
Class names, or a function of the part's state that returns them.
Type string | ((state: NoInfer<AvatarState>) => string)
- render
Renders your own element: one that receives the part's props, or a function of the props and the state.
Type RenderProp<NoInfer<AvatarState>>
- style
Styles, or a function of the part's state that returns them.
Type CSSProperties | ((state: NoInfer<AvatarState>) => CSSProperties)