UNPKG

1.1 kBTypeScriptView Raw
1/// <reference types="react" />
2
3import * as React from 'react';
4import CommonProps from '../util';
5
6export interface AvatarProps extends React.HTMLAttributes<HTMLElement>, CommonProps {
7 /**
8 * children
9 */
10 children?: React.ReactNode;
11 /**
12 * 头像的大小
13 */
14 size?: 'small' | 'medium' | 'large' | number;
15 /**
16 * 头像的形状
17 */
18 shape?: 'circle' | 'square';
19 /**
20 * icon 类头像的图标类型,可设为 Icon 的 `type` 或 `ReactNode`
21 */
22 icon?: React.ReactNode | string;
23 /**
24 * 图片类头像的资源地址
25 */
26 src?: string;
27 /**
28 * 图片加载失败的事件,返回 false 会关闭组件默认的 fallback 行为
29 */
30 onError?: () => boolean,
31 /**
32 * 图像无法显示时的 alt 替代文本
33 */
34 alt?: string;
35 /**
36 * 图片类头像响应式资源地址
37 */
38 srcSet?: string;
39
40}
41
42export default class Avatar extends React.Component<AvatarProps, any> {}