Files
ox_lib/web/src/features/dialog/components/fields/textarea.tsx

34 lines
954 B
TypeScript

import { Textarea } from '@mantine/core';
import { UseFormRegisterReturn } from 'react-hook-form';
import { ITextarea } from '../../../../typings/dialog';
import React from 'react';
import LibIcon from '../../../../components/LibIcon';
interface Props {
register: UseFormRegisterReturn;
row: ITextarea;
index: number;
}
const TextareaField: React.FC<Props> = (props) => {
return (
<Textarea
{...props.register}
defaultValue={props.row.default}
label={props.row.label}
description={props.row.description}
icon={props.row.icon && <LibIcon icon={props.row.icon} fixedWidth />}
placeholder={props.row.placeholder}
disabled={props.row.disabled}
withAsterisk={props.row.required}
autosize={props.row.autosize}
minRows={props.row.min}
maxRows={props.row.max}
minLength={props.row.minLength}
maxLength={props.row.maxLength}
/>
);
};
export default TextareaField;