{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "field",
  "title": "Field",
  "description": "A form control with its label, hint and error, wired together for screen readers.",
  "dependencies": [
    "@base-ui/react@^1.9.0"
  ],
  "registryDependencies": [
    "https://sproutboat.com/ikada/r/theme.json",
    "https://sproutboat.com/ikada/r/cn.json",
    "https://sproutboat.com/ikada/r/label.json"
  ],
  "files": [
    {
      "path": "registry/ikada/ui/field.tsx",
      "content": "\"use client\";\n\nimport { Field as BaseField } from \"@base-ui/react/field\";\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { cn } from \"@/components/ikada/lib/cn\";\nimport { labelStyles } from \"@/components/ikada/label\";\n\nexport interface FieldProps extends Omit<ComponentProps<typeof BaseField.Root>, \"className\" | \"children\"> {\n  className?: string;\n  /** Visible label, linked to the control inside. */\n  label: ReactNode;\n  /** Muted help text under the control, linked as its description. */\n  description?: ReactNode;\n  /** When set the field is invalid and the message is announced. */\n  error?: ReactNode;\n  /** Adds an asterisk to the label. Set `required` on the control too for validation. */\n  required?: boolean;\n  /** One control: Input, Select, Checkbox... Base UI wires id and aria. */\n  children: ReactNode;\n}\n\n/** A form control with its label, hint and error, wired together for screen readers. */\nexport function Field({\n  label,\n  description,\n  error,\n  required,\n  className,\n  children,\n  invalid,\n  ref,\n  ...props\n}: FieldProps) {\n  return (\n    <BaseField.Root\n      data-slot=\"field\"\n      ref={ref}\n      invalid={invalid ?? Boolean(error)}\n      className={cn(\"flex w-full flex-col gap-1.5\", className)}\n      {...props}\n    >\n      <BaseField.Label className={labelStyles}>\n        <span className=\"min-w-0 [overflow-wrap:anywhere]\">\n          {label}\n          {required ? (\n            <span aria-hidden=\"true\" className=\"ms-1 text-fg-muted\">\n              *\n            </span>\n          ) : null}\n        </span>\n      </BaseField.Label>\n      {children}\n      {description ? (\n        <BaseField.Description className=\"text-pretty text-sb-sm text-fg-muted [overflow-wrap:anywhere]\">\n          {description}\n        </BaseField.Description>\n      ) : null}\n      <BaseField.Error\n        match={Boolean(error)}\n        className=\"flex items-start gap-1.5 text-pretty text-sb-sm text-danger-fg [overflow-wrap:anywhere]\"\n      >\n        {error}\n      </BaseField.Error>\n    </BaseField.Root>\n  );\n}\n",
      "type": "registry:ui",
      "target": "@components/ikada/field.tsx"
    }
  ],
  "categories": [
    "forms"
  ],
  "type": "registry:ui"
}