CoastalCommitsPastes/client/components/input/index.tsx

26 lines
588 B
TypeScript
Raw Normal View History

2022-04-09 20:48:19 -04:00
import React from "react"
import styles from "./input.module.css"
type Props = React.HTMLProps<HTMLInputElement> & {
2022-04-09 20:48:19 -04:00
label?: string
fontSize?: number | string
}
// eslint-disable-next-line react/display-name
2022-04-09 20:48:19 -04:00
const Input = React.forwardRef<HTMLInputElement, Props>(
({ label, className, ...props }, ref) => {
return (
<div className={styles.wrapper}>
{label && <label className={styles.label}>{label}</label>}
<input
ref={ref}
className={className ? `${styles.input} ${className}` : styles.input}
{...props}
/>
</div>
)
}
)
export default Input