Skip to content

Commit 4095743

Browse files
committed
fix(forms): show visual indication of required fields
1 parent 8c65055 commit 4095743

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/forms/FormLabel.jsx

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33

4-
export function FormLabel({ id, label }) {
5-
return <label htmlFor={id}>{label}</label>;
4+
export function FormLabel({ id, label, required }) {
5+
return (
6+
<label htmlFor={id}>
7+
{label}
8+
9+
{required && <span className="text-danger"> *</span>}
10+
</label>
11+
);
612
}
713

814
FormLabel.propTypes = {
915
id: PropTypes.string,
1016
label: PropTypes.string,
17+
required: PropTypes.bool,
1118
};

0 commit comments

Comments
 (0)