Warcraft Label
warcraftcn/labelFreeComponent
A Warcraft-themed label component for form inputs with required indicator and disabled state support
Live preview
live · rendered by the registry
Rendered by warcraftcn on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://www.warcraftcn.com/r/label.jsonSource
1"use client";23import * as React from "react";4import * as LabelPrimitive from "@radix-ui/react-label";5import { cva, type VariantProps } from "class-variance-authority";67import { cn } from "@/lib/utils";89import "@/components/ui/warcraftcn/styles/warcraft.css";1011const labelVariants = cva(12 "fantasy text-sm font-medium leading-none select-none",13 {14 variants: {15 variant: {16 default:17 "text-amber-200 [text-shadow:0_0_6px_rgba(251,191,36,0.25)]",18 muted: "text-amber-200/60",19 },20 },21 defaultVariants: {22 variant: "default",23 },24 }25);2627type LabelProps = React.ComponentProps<typeof LabelPrimitive.Root> &28 VariantProps<typeof labelVariants> & {29 required?: boolean;30 disabled?: boolean;31 };3233function Label({34 className,35 variant,36 required = false,37 disabled = false,38 children,39 ...props40}: LabelProps) {41 return (42 <LabelPrimitive.Root43 data-slot="label"44 data-disabled={disabled || undefined}45 className={cn(46 labelVariants({ variant }),47 disabled && "cursor-not-allowed opacity-50",48 className49 )}50 {...props}51 >52 {children}53 {required && (54 <>55 <span56 aria-hidden="true"57 className="ml-1 text-red-500 [text-shadow:0_0_6px_rgba(239,68,68,0.4)]"58 >59 ✦60 </span>61 <span className="sr-only">(required)</span>62 </>63 )}64 </LabelPrimitive.Root>65 );66}6768export { Label, labelVariants };69export type { LabelProps };
What it pulls in
npm packages
Files it writes
More from warcraftcn
All 16 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Warcraft Accordionaccordion | warcraftcn | Components | Free | 1 dep · 7 files | |
| Warcraft Avataravatar | warcraftcn | Components | Free | no deps · 7 files | |
| Warcraft Badgebadge | warcraftcn | Components | Free | no deps · 4 files | |
| Warcraft Buttonbutton | warcraftcn | Components | Free | no deps · 6 files | |
| Warcraft Cardcard | warcraftcn | Components | Free | no deps · 3 files | |
| Warcraft Checkboxcheckbox | warcraftcn | Components | Free | 1 dep · 12 files | |
| Warcraft Cursorcursor | warcraftcn | Components | Free | no deps · 6 files | |
| Warcraft Dropdown Menudropdown-menu | warcraftcn | Components | Free | 2 deps · 3 files |
