1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-25 14:34:19 +00:00
pds-2021-g2-nest/nest_frontend/components/base/formparts/FormLabel.js

28 lines
764 B
JavaScript
Raw Normal View History

2021-04-22 17:10:19 +00:00
import React, { Fragment } from "react"
2021-04-26 16:36:41 +00:00
import Style from "./FormLabel.module.css"
2021-04-22 17:10:19 +00:00
/**
2021-04-26 16:36:41 +00:00
* A row of a {@link FormLabelled}.
*
* It displays a label on the first column and a container for the labelled element on the second column.
*
* @param children - The labelled element.
* @param text - Text to be displayed in the label.
* @param htmlFor - The `[id]` of the labelled element.
* @returns {JSX.Element}
* @constructor
*/
2021-04-26 16:36:41 +00:00
export default function FormLabel({ children, text, htmlFor }) {
2021-04-22 17:10:19 +00:00
return (
<Fragment>
2021-05-11 14:37:15 +00:00
<label htmlFor={htmlFor} className={Style.LabelText}>
2021-04-22 17:10:19 +00:00
{text}
</label>
<div className={Style.LabelContent}>
{children}
</div>
</Fragment>
)
}