Label

A form label associated with an input field.

Basic

Use htmlFor to associate the label with an input by its id. Clicking the label focuses the input.

<Label htmlFor="username">Username</Label>
<Input id="username" placeholder="Enter your username" />

Required

Set required to append a red asterisk. The asterisk is aria-hidden so screen readers are not affected — use native HTML required on the input for accessibility.

<Label htmlFor="email-req" required>Email address</Label>
<Input id="email-req" type="email" placeholder="you@example.com" required />

<Label htmlFor="password-req" required>Password</Label>
<Input id="password-req" type="password" placeholder="••••••••" required />

Props

PropTypeDefaultDescription
requiredbooleanfalseAppends a red asterisk (aria-hidden) to indicate a required field
htmlForstringID of the associated input element
classNamestringAdditional Tailwind classes
childrenReactNodeLabel text