2025-08-05 19:06:47 +03:00
|
|
|
import { ComponentChildren, RefObject } from "preact";
|
2025-08-04 20:34:47 +03:00
|
|
|
|
|
|
|
|
interface FormGroupProps {
|
2025-08-05 19:06:47 +03:00
|
|
|
labelRef?: RefObject<HTMLLabelElement>;
|
2025-08-06 18:38:52 +03:00
|
|
|
label?: string;
|
2025-08-04 21:17:35 +03:00
|
|
|
title?: string;
|
|
|
|
|
className?: string;
|
2025-08-04 20:34:47 +03:00
|
|
|
children: ComponentChildren;
|
2025-08-04 21:17:35 +03:00
|
|
|
description?: string;
|
2025-08-04 20:34:47 +03:00
|
|
|
}
|
|
|
|
|
|
2025-08-05 19:06:47 +03:00
|
|
|
export default function FormGroup({ label, title, className, children, description, labelRef }: FormGroupProps) {
|
2025-08-04 20:34:47 +03:00
|
|
|
return (
|
2025-08-06 11:39:31 +03:00
|
|
|
<div className={`form-group ${className}`} title={title}
|
|
|
|
|
style={{ "margin-bottom": "15px" }}>
|
2025-08-05 19:06:47 +03:00
|
|
|
<label style={{ width: "100%" }} ref={labelRef}>
|
2025-08-06 18:38:52 +03:00
|
|
|
{label && <div style={{ "margin-bottom": "10px" }}>{label}</div> }
|
2025-08-06 11:39:31 +03:00
|
|
|
{children}
|
2025-08-04 20:34:47 +03:00
|
|
|
</label>
|
2025-08-04 21:17:35 +03:00
|
|
|
|
2025-08-05 22:11:16 +03:00
|
|
|
{description && <small className="form-text">{description}</small>}
|
2025-08-04 20:34:47 +03:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|