@yamada-ui/react
Version:
React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion
76 lines (75 loc) • 2.02 kB
TypeScript
import { HTMLProps, PropGetter } from "../../core/components/index.types.js";
import "../../core/index.js";
import { ReactElement, ReactNode } from "react";
//#region src/components/avatar/use-avatar.d.ts
interface UseAvatarProps extends HTMLProps {
/**
* The name of the person in the avatar.
*
* - If `src` has loaded, the name will be used as the `alt` attribute of the `img`
* - If `src` is not loaded, the name will be used to create the initials
*/
name?: string;
/**
* The image url of the avatar.
*/
src?: HTMLProps<"img">["src"];
/**
* List of sources to use for different screen resolutions.
*/
srcSet?: HTMLProps<"img">["srcSet"];
/**
* The `HTMLImageElement` property `alt`.
*/
alt?: HTMLProps<"img">["alt"];
/**
* The `HTMLImageElement` property `crossOrigin`.
*/
crossOrigin?: HTMLProps<"img">["crossOrigin"];
/**
* The fallback text to display if the image is not provided.
*/
fallback?: ReactNode;
/**
* Function to get the initials to display.
*/
format?: (name: string) => string;
/**
* The avatar icon to use.
*/
icon?: ReactElement;
/**
* Defines loading strategy.
*/
loading?: HTMLProps<"img">["loading"];
/**
* Defining which referrer is sent when fetching the resource.
*
* @default 'no-referrer'
*/
referrerPolicy?: HTMLProps<"img">["referrerPolicy"];
}
declare const useAvatar: ({
name,
src,
srcSet,
alt,
crossOrigin,
fallback: fallbackMessage,
format,
icon,
loading,
referrerPolicy,
...rest
}?: UseAvatarProps) => {
name: string | undefined;
loaded: boolean;
getFallbackProps: PropGetter<"div", undefined, undefined>;
getGroupProps: PropGetter<"div", undefined, undefined>;
getImageProps: PropGetter<"img", undefined, undefined>;
getRootProps: PropGetter<"div", undefined, undefined>;
};
type UseAvatarReturn = ReturnType<typeof useAvatar>;
//#endregion
export { UseAvatarProps, UseAvatarReturn, useAvatar };
//# sourceMappingURL=use-avatar.d.ts.map