Join our Discord Community

Label

Accessible form labels for React and Next.js applications. Built with Radix UI and styled with Tailwind CSS for perfect shadcn/ui integration.

You know how annoying it is when you click a form and have no idea what to type? Labels fix that. This component does all the accessibility magic so you don't have to think about it.

Basic form label

Clean, accessible labeling for any form control:

Loading component...

Built on Radix UI so the accessibility stuff just works. Pairs perfectly with all the other shadcn/ui form components.

npx shadcn@latest add label

Why you actually need these

Ever tried using a form with a screen reader? It's a nightmare without proper labels. But even regular users get confused when they don't know what goes where.

Here's a nice bonus: when you click the label, it automatically focuses the input. That little detail makes your forms feel way more polished.

Essential label patterns

Checkbox with label

Much easier to hit the label than that tiny checkbox:

Loading component...

Input with label

The classic input-label combo:

Loading component...

Radio group labels

Each radio option gets its own clickable label:

Loading component...

Required field indicators

Red asterisk so people know what's required:

Loading component...

Textarea labeling

Works with textareas too:

Loading component...

Just works with your React setup

Throw these into any form - React Hook Form, Formik, whatever you're using. The htmlFor prop connects everything automatically and handles all the screen reader stuff for you.

API Reference

Label

A semantic label element with built-in accessibility features.

PropTypeDefaultDescription
htmlForstring-ID of the associated form control
classNamestring-Additional CSS classes
childrenReact.ReactNode-Label text and content

Accessibility Features

FeatureImplementation
Semantic HTMLUses proper <label> element
Form AssociationConnects to controls via htmlFor
Click BehaviorClicking label focuses associated input
Screen ReadersProperly announces form relationships
Keyboard NavigationIntegrates with form tab order

Style however you want

Add any Tailwind classes to make them fit your design:

<Label className="text-sm font-medium">Small Label</Label>
<Label className="text-lg text-blue-600">Big Blue Label</Label>

Common patterns

Required fields - Add visual indicators like asterisks or "required" text.

Optional fields - Mark optional fields when most are required.

Help text - Combine labels with description text for complex fields.

Form sections - Use consistent labeling within grouped form sections.

Write labels that actually help

  • Be specific - "Email address" beats just "Email"
  • Don't repeat placeholders - If your label says "Email" don't make the placeholder say "Email" too
  • Mark required stuff - Red asterisks, "required" text, whatever works for your design
  • Keep it scannable - People skim forms looking for what they need
  • Test with screen readers - Turn on VoiceOver and make sure it makes sense