UNPKG

@nutui/nutui-react

Version:

京东风格的轻量级移动端 React 组件库,支持一套代码生成 H5 和小程序

77 lines (76 loc) 1.72 kB
import { BasicComponent } from '../../utils/typings'; import * as React from 'react'; export type ToastPosition = 'top' | 'bottom' | 'center'; export type ToastIcon = 'success' | 'fail' | 'loading' | 'warn' | React.ReactNode; export type ToastWordBreak = 'normal' | 'break-all' | 'break-word'; export interface ToastProps extends BasicComponent { id?: string; /** * 展示时长(秒),值为 0 时,toast 不会自动消失 * @default 2 */ duration?: number /** * toast展示位置 * @default center */ position?: ToastPosition /** * 标题 * @default - */ title?: string /** * 是否在点击遮罩层后关闭提示 * @default false */ closeOnOverlayClick?: boolean /** * 背景是否锁定 * @default false */ lockScroll?: boolean /** * 文案尺寸,三选一 * @default base */ size?: string | number /** * 自定义图标 * @default - */ icon?: ToastIcon /** * 消息文本内容 * @default - */ content?: React.ReactNode /** * 关闭时触发的事件 * @default () => void */ onClose?: () => void /** * 自定义内容区类名 * @default - */ contentClassName?: string /** * 自定义内容区样式 * @default - */ contentStyle?: React.CSSProperties /** * 换行截断方式 * @default break-all */ wordBreak?: ToastWordBreak } declare function show(option: ToastProps | string): void; declare function config(config: ToastProps): void; declare const _default: { show: typeof show; config: typeof config; clear(): void; }; export default _default;