<html.label>
The <html.label>
component lets you render a form field label.
Overview
To display a label for a form field, render the <html.label>
component and link it to the field via the for
prop.
import { html } from 'react-strict-dom';
import { useId } from 'react';
const Foo = () => {
const id = useId();
return (
<>
<html.label for={id} />
<html.input id={id} />
</>
);
);
Props
- ...Common props
for
- Equivalent tohtmlFor
in React DOM.