Docs
Label
Label
Renders an accessible label associated with controls.
Installation
Copy and paste the following code into your project.
"use client"
import * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"
import { Label, LabelProps } from "react-aria-components"
import { cn } from "@/lib/utils"
const labelVariants = cva(
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-70"
)
const _Label = ({ className, ...props }: LabelProps) => (
<Label className={cn(labelVariants(), className)} {...props} />
)
export { _Label as Label, labelVariants }
Update the import paths to match your project setup.
Usage
import { Label } from "@/components/ui/label"
<Label htmlFor="email">Your email address</Label>