melt
Version:
The next generation of Melt UI. Built for Svelte 5.
38 lines (37 loc) • 1.19 kB
TypeScript
import type { MaybeGetter } from "../types";
export type ImageLoadingStatus = "loading" | "loaded" | "error";
export type AvatarProps = {
/**
* The source of the image to display.
*/
src?: MaybeGetter<string | undefined>;
/**
* The amount of time in milliseconds to wait before displaying the image.
*
* @default 0
*/
delayMs?: MaybeGetter<number | undefined>;
/**
* A callback invoked when the loading status store of the avatar changes.
*/
onLoadingStatusChange?: (value: ImageLoadingStatus) => void | undefined;
};
export declare class Avatar {
#private;
readonly src: string;
readonly delayMs: number;
constructor(props?: AvatarProps);
get loadingStatus(): ImageLoadingStatus;
get image(): {
readonly "data-melt-avatar-image": "";
readonly src: string;
readonly style: `display: ${string}`;
readonly onload: () => (() => void) | undefined;
readonly onerror: () => void;
};
get fallback(): {
readonly "data-melt-avatar-fallback": "";
readonly style: `display: ${string}` | undefined;
readonly hidden: true | undefined;
};
}