mirror of
https://github.com/ConvoyPanel/panel.git
synced 2026-07-02 03:34:21 +08:00
15 lines
575 B
TypeScript
15 lines
575 B
TypeScript
import TextInput from '@/components/elements/inputs/TextInput'
|
|
import { TextInputProps } from '@mantine/core'
|
|
import { Field as FormikField, FieldProps } from 'formik'
|
|
import { forwardRef } from 'react'
|
|
|
|
const TextInputFormik = forwardRef<HTMLInputElement, Omit<TextInputProps, 'error'>>(({ name, ...props }, ref) => (
|
|
<FormikField innerRef={ref} name={name}>
|
|
{({ field, meta: {error, touched} }: FieldProps) => (
|
|
<TextInput {...field} {...props} error={touched ? error : undefined} />
|
|
)}
|
|
</FormikField>
|
|
))
|
|
|
|
export default TextInputFormik
|