-
-
Save Shivam38391/d666b56c881d2babc859b5bb39cca041 to your computer and use it in GitHub Desktop.
production level react component input.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useId, ref } from 'react' | |
const Input = React.forwardRef(function Input({ | |
label, | |
type = 'text', | |
className = "", | |
...props | |
}, ref) { | |
const id = useId(); | |
return ( | |
<div className='w-full' > | |
{label && <label className='inline-block mb-1 text-[14px] font-medium text-neutral500' htmlFor={id}>{label}</label>} | |
<input | |
id={id} type={type} | |
className={` bg-white text-neutral500 p-2 rounded-lg border border-neutral100 w-full focus:border-[#000000] ${className}`} | |
ref={ref} {...props} /> | |
</div> | |
) | |
}) | |
export default Input |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment