Skip to content

Commit 58f9bd4

Browse files
(FormElement): apply id and htmlFor straightforwardly
1 parent 3b308d3 commit 58f9bd4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/scripts/FormElement.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { TooltipContent } from './TooltipContent';
1818
export type FormElementProps = {
1919
id?: string;
2020
className?: string;
21+
htmlFor?: string;
2122
label?: string;
2223
required?: boolean;
2324
error?: boolean | string | { message: string };
@@ -43,6 +44,7 @@ export const FormElement = createFC<
4344
const {
4445
id,
4546
className,
47+
htmlFor,
4648
cols = 1,
4749
elementRef,
4850
label,
@@ -96,8 +98,9 @@ export const FormElement = createFC<
9698
<div ref={elementRef} className={formElementClassNames}>
9799
{label ? (
98100
<LabelTag
101+
id={id}
99102
className='slds-form-element__label'
100-
htmlFor={id}
103+
htmlFor={htmlFor}
101104
onClick={id ? undefined : onClickLabel}
102105
>
103106
{required ? (

0 commit comments

Comments
 (0)