DOM elements

<label>

Associate a label with its control by nesting or htmlFor and a unique id. useId provides an instance-specific association.

Formal Syntax & Structure

react syntaxreact
<label ... />

Working Example

Example Snippetreact
import {useId} from 'react';export default function App(){const id=useId();return <><label htmlFor={id}>Stock</label><input id={id}/></>}
React Reference