Files
ox_lib/web/src/features/dialog/components/fields/textarea.tsx
2023-11-15 15:28:21 +01:00

32 lines
878 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}
/>
);
};
export default TextareaField;