{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"label","type":"registry:ui","title":"Label","description":"A form label with a decorative required asterisk, wired to a FormField's context when it has one","categories":["forms"],"registryDependencies":["https://fancy-ui.rama.app/r/internals.json","https://fancy-ui.rama.app/r/internals-dom.json","https://fancy-ui.rama.app/r/utils.json"],"files":[{"path":"react/src/components/label/Label.tsx","content":"\"use client\";\n\nimport { forwardRef } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { cn } from \"../../utils\";\nimport { useField } from \"../../internals/field\";\n\nexport interface LabelProps {\n\t/** Explicit target id. Inside a FormField the field's own control id wins — see the README. */\n\thtmlFor?: string;\n\t/** Renders the required asterisk. Inside a FormField the field's own `required` wins. */\n\trequired?: boolean;\n\t/** The label text/content. */\n\tchildren?: ReactNode;\n\t/** Additional CSS classes */\n\tclassName?: string;\n}\n\n/**\n * A form label that defers to a surrounding `FormField` for its wiring.\n *\n * The root element arrives through the ref channel, per PORTING.md — the\n * Svelte source declares `ref = $bindable(null)`.\n */\nexport const Label = forwardRef<HTMLLabelElement, LabelProps>(function Label(\n\t{ htmlFor, required = false, children, className },\n\tref\n) {\n\t// A surrounding FormField exists specifically so a caller never wires\n\t// `htmlFor` by hand, so it is the authority over both of these whenever\n\t// one is present — the same precedence every control in this wave follows\n\t// for its own id/required/disabled. Standalone, with no FormField above,\n\t// the plain props are all there is.\n\tconst field = useField();\n\tconst resolvedFor = field?.controlId ?? htmlFor;\n\tconst resolvedRequired = field?.required ?? required;\n\t// Not a prop — `field.labelId` only exists to be carried on *this*\n\t// element, so a control whose root isn't labelable (a `<div\n\t// role=\"radiogroup\">`, say) has an id to point its own `aria-labelledby`\n\t// at. `undefined` outside a FormField: nothing needs to reach a\n\t// standalone Label that way, `htmlFor` already does the job wherever it\n\t// applies.\n\tconst labelId = field?.labelId;\n\n\treturn (\n\t\t<label\n\t\t\tref={ref}\n\t\t\tid={labelId}\n\t\t\thtmlFor={resolvedFor}\n\t\t\tclassName={cn(\"ft-label text-[13px] font-medium\", className)}\n\t\t>\n\t\t\t{children}{\" \"}\n\t\t\t{resolvedRequired ? (\n\t\t\t\t<span aria-hidden=\"true\" className=\"text-destructive\">\n\t\t\t\t\t*\n\t\t\t\t</span>\n\t\t\t) : null}\n\t\t</label>\n\t);\n});\n","type":"registry:ui","target":"@ui/fancy/components/label/Label.tsx"},{"path":"react/src/components/label/index.ts","content":"\"use client\";\n\nexport { Label } from \"./Label\";\nexport type { LabelProps } from \"./Label\";\n","type":"registry:ui","target":"@ui/fancy/components/label/index.ts"}]}