# Label

An accessible form label built on Radix Label, rendering a native <label> with disabled and peer-state styling.

- Category: Forms
- License: MIT
- Page: https://www.saasuji.com/components/label
- Install: npx shadcn@latest add https://www.saasuji.com/r/label.json

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| htmlFor | `string` | — | Associates the label with the id of its form control. |
| className | `string` | — | Additional classes merged onto the label. |
| children | `React.ReactNode` | — | Label text or inline content. |
| ...props | `React.ComponentProps<typeof LabelPrimitive.Root>` | — | All remaining Radix Label root props (id, asChild, onMouseDown, …) are forwarded. |

## Source

```tsx
"use client"

import * as React from "react"
import { Label as LabelPrimitive } from "radix-ui"

import { cn } from "@/lib/utils"

function Label({
  className,
  ...props
}: React.ComponentProps<typeof LabelPrimitive.Root>) {
  return (
    <LabelPrimitive.Root
      data-slot="label"
      className={cn(
        "flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
        className
      )}
      {...props}
    />
  )
}

export { Label }

```
