summaryrefslogtreecommitdiffstats
path: root/src/components/atoms/forms/label.tsx
blob: 860cd7340c6d3b39bc672528ad87bea1fdc1c36b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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;