Grouped components into folders
This commit is contained in:
25
client/components/common/form/FormField.tsx
Normal file
25
client/components/common/form/FormField.tsx
Normal file
@@ -0,0 +1,25 @@
|
||||
/* eslint-disable react/display-name */
|
||||
import { forwardRef, ReactNode } from "react"
|
||||
|
||||
import Input from "../Input"
|
||||
|
||||
interface FormFieldProps extends React.ComponentPropsWithoutRef<"input"> {
|
||||
label?: string
|
||||
bottomElement?: ReactNode
|
||||
}
|
||||
|
||||
const FormField = forwardRef<HTMLInputElement, FormFieldProps>(
|
||||
({ label, bottomElement, hidden, ...inputProps }, ref) => {
|
||||
return (
|
||||
<div className="space-y-1">
|
||||
<label htmlFor={inputProps.id} className="font-semibold text-sm">
|
||||
{label}
|
||||
</label>
|
||||
<Input {...inputProps} ref={ref} />
|
||||
{bottomElement}
|
||||
</div>
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
export default FormField
|
Reference in New Issue
Block a user