Skip to Content
✨ Just dropped my UI Library — still cooking up some magic! Stay tuned & maybe… hire me  or sponsor me 😉 
DocumentationLabel

Label

A semantic and accessible label component that extends HTML label functionality with consistent styling and enhanced features. Perfect for form elements and interactive components.

Install Dependencies

npx
quickcode-ui add Label

Default Usage

Default Label

Required Field Indicator

Required Field

Label Variants

Label Variants

Label Sizes

Label Sizes

Props

PropTypeDefaultDescription
size"sm" | "md" | "lg""md"Size variant that affects text size
variant"default" | "muted" | "accent""default"Visual style variant of the label
requiredbooleanfalseShows a red asterisk (*) indicator for required fields
childrenReact.ReactNode-The label text or content
...propsLabelHTMLAttributes-All standard HTML label attributes (htmlFor, onClick, etc.)

Features

  • Semantic HTML: Built on native label element for proper accessibility
  • Screen Reader Friendly: Properly associates labels with form controls
  • Required Field Support: Built-in asterisk indicator for required fields
  • Flexible Styling: Multiple variants and sizes for different use cases
  • Keyboard Accessible: Full keyboard navigation support
  • Dark Mode Ready: Automatic support for light and dark themes
  • Disabled State Handling: Automatically styles for disabled form controls

The Label component automatically handles the disabled state styling when used with disabled form controls through CSS peer selectors, ensuring consistent visual feedback across your forms.

Last updated on