option to make textarea input required or optional

This commit is contained in:
Anton Tranelis 2024-11-29 18:05:26 +01:00
parent af639c7224
commit 3014cf682f
2 changed files with 6 additions and 1 deletions

View File

@ -15,6 +15,7 @@ type TextAreaProps = {
inputStyle?: string
defaultValue: string
placeholder?: string
required?: boolean
updateFormValue?: (value: string) => void
}
@ -30,6 +31,7 @@ export function TextAreaInput({
inputStyle,
defaultValue,
placeholder,
required = true,
updateFormValue,
}: TextAreaProps) {
const ref = useRef<HTMLTextAreaElement>(null)
@ -90,7 +92,7 @@ export function TextAreaInput({
</label>
) : null}
<textarea
required
required={required}
ref={ref}
value={inputValue}
name={dataField}

View File

@ -18,6 +18,7 @@ export const ProfileTextForm = ({
heading,
size,
hideInputLabel,
required,
}: {
state: FormState
setState: React.Dispatch<React.SetStateAction<any>>
@ -25,6 +26,7 @@ export const ProfileTextForm = ({
heading: string
size: string
hideInputLabel: boolean
required?: boolean
}) => {
const [field, setField] = useState<string>(dataField || 'text')
@ -57,6 +59,7 @@ export const ProfileTextForm = ({
labelStyle={hideInputLabel ? 'tw-hidden' : ''}
containerStyle={size === 'full' ? 'tw-grow tw-h-full' : ''}
inputStyle={size === 'full' ? 'tw-h-full' : 'tw-h-24'}
required={required}
/>
</div>
)