From 470e631d5657c9eb50ba0e13fadf3452e77ff499 Mon Sep 17 00:00:00 2001
From: Stefan Malzner <stefan@adlk.io>
Date: Fri, 5 Apr 2019 11:36:04 +0200
Subject: Add asterisk if input is required

---
 packages/forms/src/label/index.tsx | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 'packages/forms/src/label/index.tsx')

diff --git a/packages/forms/src/label/index.tsx b/packages/forms/src/label/index.tsx
index 590270a06..1b33ba22c 100644
--- a/packages/forms/src/label/index.tsx
+++ b/packages/forms/src/label/index.tsx
@@ -9,6 +9,7 @@ import styles from './styles';
 
 interface ILabel extends IFormField, React.LabelHTMLAttributes<HTMLLabelElement> {
   classes: Classes;
+  isRequired: boolean;
 }
 
 class LabelComponent extends Component<ILabel> {
@@ -24,6 +25,7 @@ class LabelComponent extends Component<ILabel> {
       className,
       children,
       htmlFor,
+      isRequired,
     } = this.props;
 
     if (!showLabel) return children;
@@ -36,7 +38,7 @@ class LabelComponent extends Component<ILabel> {
         htmlFor={htmlFor}
       >
         {showLabel && (
-          <span className={classes.label}>{title}</span>
+          <span className={classes.label}>{title}{isRequired && ' *'}</span>
         )}
         <div className={classes.content}>
           {children}
-- 
cgit v1.2.3-70-g09d2

