mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-13 07:46:10 +00:00
option to make textarea input required or optional
This commit is contained in:
parent
af639c7224
commit
3014cf682f
@ -15,6 +15,7 @@ type TextAreaProps = {
|
|||||||
inputStyle?: string
|
inputStyle?: string
|
||||||
defaultValue: string
|
defaultValue: string
|
||||||
placeholder?: string
|
placeholder?: string
|
||||||
|
required?: boolean
|
||||||
updateFormValue?: (value: string) => void
|
updateFormValue?: (value: string) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,6 +31,7 @@ export function TextAreaInput({
|
|||||||
inputStyle,
|
inputStyle,
|
||||||
defaultValue,
|
defaultValue,
|
||||||
placeholder,
|
placeholder,
|
||||||
|
required = true,
|
||||||
updateFormValue,
|
updateFormValue,
|
||||||
}: TextAreaProps) {
|
}: TextAreaProps) {
|
||||||
const ref = useRef<HTMLTextAreaElement>(null)
|
const ref = useRef<HTMLTextAreaElement>(null)
|
||||||
@ -90,7 +92,7 @@ export function TextAreaInput({
|
|||||||
</label>
|
</label>
|
||||||
) : null}
|
) : null}
|
||||||
<textarea
|
<textarea
|
||||||
required
|
required={required}
|
||||||
ref={ref}
|
ref={ref}
|
||||||
value={inputValue}
|
value={inputValue}
|
||||||
name={dataField}
|
name={dataField}
|
||||||
|
|||||||
@ -18,6 +18,7 @@ export const ProfileTextForm = ({
|
|||||||
heading,
|
heading,
|
||||||
size,
|
size,
|
||||||
hideInputLabel,
|
hideInputLabel,
|
||||||
|
required,
|
||||||
}: {
|
}: {
|
||||||
state: FormState
|
state: FormState
|
||||||
setState: React.Dispatch<React.SetStateAction<any>>
|
setState: React.Dispatch<React.SetStateAction<any>>
|
||||||
@ -25,6 +26,7 @@ export const ProfileTextForm = ({
|
|||||||
heading: string
|
heading: string
|
||||||
size: string
|
size: string
|
||||||
hideInputLabel: boolean
|
hideInputLabel: boolean
|
||||||
|
required?: boolean
|
||||||
}) => {
|
}) => {
|
||||||
const [field, setField] = useState<string>(dataField || 'text')
|
const [field, setField] = useState<string>(dataField || 'text')
|
||||||
|
|
||||||
@ -57,6 +59,7 @@ export const ProfileTextForm = ({
|
|||||||
labelStyle={hideInputLabel ? 'tw-hidden' : ''}
|
labelStyle={hideInputLabel ? 'tw-hidden' : ''}
|
||||||
containerStyle={size === 'full' ? 'tw-grow tw-h-full' : ''}
|
containerStyle={size === 'full' ? 'tw-grow tw-h-full' : ''}
|
||||||
inputStyle={size === 'full' ? 'tw-h-full' : 'tw-h-24'}
|
inputStyle={size === 'full' ? 'tw-h-full' : 'tw-h-24'}
|
||||||
|
required={required}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user