fix: simplifies field error paths (#5504)
This commit is contained in:
@@ -13,6 +13,7 @@ import './index.scss'
|
||||
|
||||
const DefaultFieldLabel: React.FC<LabelProps> = (props) => {
|
||||
const {
|
||||
as: Element = 'label',
|
||||
htmlFor: htmlForFromProps,
|
||||
label: labelFromProps,
|
||||
required = false,
|
||||
@@ -27,10 +28,10 @@ const DefaultFieldLabel: React.FC<LabelProps> = (props) => {
|
||||
|
||||
if (labelFromProps) {
|
||||
return (
|
||||
<label className={`field-label ${unstyled ? 'unstyled' : ''}`} htmlFor={htmlFor}>
|
||||
<Element className={`field-label ${unstyled ? 'unstyled' : ''}`} htmlFor={htmlFor}>
|
||||
{getTranslation(labelFromProps, i18n)}
|
||||
{required && !unstyled && <span className="required">*</span>}
|
||||
</label>
|
||||
</Element>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user