Fixed form labels

This commit is contained in:
Alejandro Celaya
2022-03-05 19:43:10 +01:00
parent 661b9b2cc1
commit dee1932a64
7 changed files with 28 additions and 37 deletions

View File

@@ -15,13 +15,13 @@ export interface FormGroupContainerProps {
}
export const FormGroupContainer: FC<FormGroupContainerProps> = (
{ children, value, onChange, id, type, required, placeholder, className, labelClassName },
{ children, value, onChange, id, type, required, placeholder, className, labelClassName = '' },
) => {
const forId = useRef<string>(id ?? uuid());
return (
<FormGroup className={className ?? ''}>
{children && <label htmlFor={forId.current} className={labelClassName ?? ''}>{children}:</label>}
<label htmlFor={forId.current} className={`form-label ${labelClassName}`}>{children}:</label>
<input
className="form-control"
type={type ?? 'text'}