Label

Forms

Form label with pixel font styling.

Installation

npm install @radix-ui/react-label

Import

import { PixelLabel } from "@/components/ui/pixel-label"

Usage

Component Source

Copy and paste the following code into your project at /src/components/ui/pixel-label.tsx

"use client";

import * as LabelPrimitive from "@radix-ui/react-label";
import type * as React from "react";
import { cn } from "@/lib/utils";

function PixelLabel({
  className,
  ...props
}: React.ComponentProps<typeof LabelPrimitive.Root>) {
  return (
    <LabelPrimitive.Root
      className={cn(
        "text-sm font-bold leading-none font-[family-name:var(--font-press-start)] select-none cursor-pointer",
        "peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
        className,
      )}
      {...props}
    />
  );
}

export { PixelLabel };

Accessibility

This component is built with accessibility in mind, including proper ARIA attributes, keyboard navigation, and focus management.