diff options
Diffstat (limited to 'packages/forms/src/label/index.tsx')
-rw-r--r-- | packages/forms/src/label/index.tsx | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/packages/forms/src/label/index.tsx b/packages/forms/src/label/index.tsx index 36fcfbedf..1b33ba22c 100644 --- a/packages/forms/src/label/index.tsx +++ b/packages/forms/src/label/index.tsx | |||
@@ -9,6 +9,7 @@ import styles from './styles'; | |||
9 | 9 | ||
10 | interface ILabel extends IFormField, React.LabelHTMLAttributes<HTMLLabelElement> { | 10 | interface ILabel extends IFormField, React.LabelHTMLAttributes<HTMLLabelElement> { |
11 | classes: Classes; | 11 | classes: Classes; |
12 | isRequired: boolean; | ||
12 | } | 13 | } |
13 | 14 | ||
14 | class LabelComponent extends Component<ILabel> { | 15 | class LabelComponent extends Component<ILabel> { |
@@ -24,8 +25,11 @@ class LabelComponent extends Component<ILabel> { | |||
24 | className, | 25 | className, |
25 | children, | 26 | children, |
26 | htmlFor, | 27 | htmlFor, |
28 | isRequired, | ||
27 | } = this.props; | 29 | } = this.props; |
28 | 30 | ||
31 | if (!showLabel) return children; | ||
32 | |||
29 | return ( | 33 | return ( |
30 | <label | 34 | <label |
31 | className={classnames({ | 35 | className={classnames({ |
@@ -34,7 +38,7 @@ class LabelComponent extends Component<ILabel> { | |||
34 | htmlFor={htmlFor} | 38 | htmlFor={htmlFor} |
35 | > | 39 | > |
36 | {showLabel && ( | 40 | {showLabel && ( |
37 | <span className={classes.label}>{title}</span> | 41 | <span className={classes.label}>{title}{isRequired && ' *'}</span> |
38 | )} | 42 | )} |
39 | <div className={classes.content}> | 43 | <div className={classes.content}> |
40 | {children} | 44 | {children} |