From 581632a626f81bce522be1cd809e9832d5b11c99 Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Thu, 31 Mar 2022 18:21:30 +0200
Subject: chore: add a Label component

---
 src/components/atoms/forms/label.tsx | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 src/components/atoms/forms/label.tsx

(limited to 'src/components/atoms/forms/label.tsx')

diff --git a/src/components/atoms/forms/label.tsx b/src/components/atoms/forms/label.tsx
new file mode 100644
index 0000000..860cd73
--- /dev/null
+++ b/src/components/atoms/forms/label.tsx
@@ -0,0 +1,23 @@
+import { FC } from 'react';
+import styles from './forms.module.scss';
+
+type LabelProps = {
+  htmlFor: string;
+  required?: boolean;
+};
+
+/**
+ * Label Component
+ *
+ * Render a HTML label element.
+ */
+const Label: FC<LabelProps> = ({ children, required = false, ...props }) => {
+  return (
+    <label className={styles.label} {...props}>
+      {children}
+      {required && <span className={styles.required}> *</span>}
+    </label>
+  );
+};
+
+export default Label;
-- 
cgit v1.2.3

