UNPKG

@nutui/nutui-react-taro

Version:

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

73 lines (72 loc) 2 kB
import { default as React, MouseEvent } from 'react'; import { ButtonProps as MiniProgramButtonProps } from '@tarojs/components'; import { BasicComponent } from '../../utils/typings'; type OmitMiniProgramButtonProps = Omit<MiniProgramButtonProps, 'size' | 'type' | 'onClick' | 'style'>; export type ButtonType = 'default' | 'primary' | 'info' | 'success' | 'warning' | 'danger'; export type ButtonSize = 'xlarge' | 'large' | 'normal' | 'small' | 'mini'; export type ButtonShape = 'square' | 'round'; export type ButtonFill = 'solid' | 'outline' | 'dashed' | 'none'; export interface ButtonProps extends BasicComponent, OmitMiniProgramButtonProps { /** * 按钮颜色,支持传入 linear-gradient 渐变色, outline 和 dashed 模式下设置的是 color,其他情况设置的是background,建议使用CSS变量实现的颜色配置 * @default - */ color: string /** * 按钮的形状 * @default round */ shape: ButtonShape /** * 按钮的样式 * @default default */ type: ButtonType /** * 按钮的尺寸 * @default normal */ size: ButtonSize /** * 填充模式 * @default solid */ fill: ButtonFill /** * 是否为块级元素 * @default false */ block: boolean /** * 按钮loading状态 * @default false */ loading: boolean /** * 是否禁用按钮 * @default false */ disabled: boolean /** * 按钮图标 * @default - */ icon: React.ReactNode /** * 右侧按钮图标 * @default - */ rightIcon: React.ReactNode /** * 按钮原始类型 * @default button */ nativeType: 'submit' | 'reset' | 'button' /** * 点击按钮时触发 * @default - */ onClick: (e: MouseEvent<HTMLButtonElement>) => void } export declare const Button: React.ForwardRefExoticComponent<Omit<Partial<ButtonProps>, "ref"> & React.RefAttributes<HTMLButtonElement>>; export {};