Files
payload/src/admin/components/forms/Label/index.tsx
2020-11-30 20:12:15 -05:00

26 lines
439 B
TypeScript

import React from 'react';
import { Props } from './types';
import './index.scss';
const Label: React.FC<Props> = (props) => {
const {
label, required = false, htmlFor,
} = props;
if (label) {
return (
<label
htmlFor={htmlFor}
className="field-label"
>
{label}
{required && <span className="required">*</span>}
</label>
);
}
return null;
};
export default Label;