UNPKG

2.84 kBTypeScriptView Raw
1import { ComponentType } from 'react'
2import { StandardProps } from './common'
3interface IconProps extends StandardProps {
4 /** icon 的类型
5 * @supported weapp, alipay, swan, tt, qq, jd, h5, rn
6 */
7 type: keyof IconProps.TIconType
8 /** icon 的大小,单位px
9 * @default 23
10 * @supported weapp, alipay, swan, tt, qq, jd, h5, rn
11 */
12 size?: string
13 /** icon 的颜色,同 css 的 color
14 * @supported weapp, alipay, swan, tt, qq, jd, h5, rn
15 */
16 color?: string
17 /** 无障碍访问,(属性)元素的额外描述
18 * @supported qq
19 */
20 ariaLabel?: string
21}
22declare namespace IconProps {
23 /** icon 的类型 */
24 interface TIconType {
25 /** 成功图标 */
26 success
27 /** 成功图标(不带外圈) */
28 success_no_circle
29 /** 信息图标 */
30 info
31 /** 警告图标 */
32 warn
33 /** 等待图标 */
34 waiting
35 /** 取消图标 */
36 cancel
37 /** 下载图标 */
38 download
39 /** 搜索图标 */
40 search
41 /** 清除图标 */
42 clear
43 /** 圆环图标(多选控件图标未选择)「微信文档未标注属性」 */
44 circle
45 /** 带圆环的信息图标「微信文档未标注属性」 */
46 info_circle
47 }
48}
49/** 图标。组件属性的长度单位默认为 px
50 * @classification base
51 * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony
52 * @example_react
53 * ```tsx
54 * export default class PageView extends Component {
55 * constructor() {
56 * super(...arguments)
57 * }
58 *
59 * render() {
60 * return (
61 * <View className='components-page'>
62 * <Icon size='60' type='success' />
63 * <Icon size='60' type='info' />
64 * <Icon size='60' type='warn' color='#ccc' />
65 * <Icon size='60' type='warn' />
66 * <Icon size='60' type='waiting' />
67 * <Icon size='20' type='success_no_circle' />
68 * <Icon size='20' type='warn' />
69 * <Icon size='20' type='success' />
70 * <Icon size='20' type='download' />
71 * <Icon size='20' type='clear' color='red' />
72 * <Icon size='20' type='search' />
73 * </View>
74 * )
75 * }
76 * }
77 * ```
78 * @example_vue
79 * <template>
80 * <view class="components-page">
81 * <icon size="60" type="success" />
82 * <icon size="60" type="info" />
83 * <icon size="60" type="warn" color="#ccc" />
84 * <icon size="60" type="warn" />
85 * <icon size="60" type="waiting" />
86 * <icon size="20" type="success_no_circle" />
87 * <icon size="20" type="warn" />
88 * <icon size="20" type="success" />
89 * <icon size="20" type="download" />
90 * <icon size="20" type="clear" color="red" />
91 * <icon size="20" type="search" />
92 * </view>
93 * </template>
94 * @see https://developers.weixin.qq.com/miniprogram/dev/component/icon.html
95 */
96declare const Icon: ComponentType<IconProps>
97export { Icon, IconProps }