@ray-js/components
Version:
Ray basic components
81 lines (80 loc) • 2.49 kB
TypeScript
import * as React from 'react';
import { BaseProps, FormEvent } from '../types';
import { GenericEvent } from '@ray-js/adapter';
export type TextareaEvent = FormEvent<{
value: string;
}>;
export interface TextareaProps extends BaseProps {
/**
* @description.en id
* @description.zh 组件的 id
* @default null
*/
name?: string;
/**
* @description.en content
* @description.zh 输入框的内容
* @default null
*/
value?: string;
/**
* @description.en Placeholder when the input box is empty
* @description.zh 输入框为空时占位符
* @default null
*/
placeholder?: string;
/**
* @description.en Specify placeholder styles that currently only support Color,font Size, and font Weight
* @description.zh 指定 placeholder 的样式,目前仅支持 color,fontSize 和 fontWeight
* @default null
*/
placeholderStyle?: React.CSSProperties;
/**
* @description.en If the Account is Disabled
* @description.zh 是否禁用
* @default null
*/
disabled?: boolean;
/**
* @description.en Maximum length. If the value is set to -1, the maximum length is not limited
* @description.zh 最大输入长度,设置为 -1 的时候不限制最大长度
* @default null
*/
maxLength?: number;
/**
* @description.en Automatic increase or not
* @description.zh 是否自动增高
* @default null
*/
autoHeight?: boolean;
/**
* @description.en Triggered when the keyboard is typed
* @description.zh 当键盘输入时,触发
* @default null
*/
onInput?: (event: TextareaEvent) => any;
/**
* @description.en Triggered when the input box is in focus
* @description.zh 输入框聚焦时触发
* @default null
*/
onFocus?: (event: GenericEvent<{
value: any;
}>) => void;
/**
* @description.en Triggered when the input box loses focus
* @description.zh 输入框失去焦点时触发
* @default null
*/
onBlur?: (event: GenericEvent<{
value: any;
}>) => void;
/**
* @description.en Called when the number of lines in the input box changes, event.detail = {height: 0, lineCount: 0}
* @description.zh 输入框行数变化时调用,event.detail = {height: 0, lineCount: 0}
* @default null
*/
onLinechange?: (event: GenericEvent<{
value: any;
}>) => void;
}