// Field Template - wraps each form field with label and description import type { FieldTemplateProps } from "@rjsf/utils"; import { Label } from "@/components/ui/label"; import { cn } from "@/lib/utils"; export function FieldTemplate(props: FieldTemplateProps) { const { id, label, children, errors, help, description, hidden, required, displayLabel, schema, uiSchema, } = props; if (hidden) { return
{children}
; } // Get UI options const uiOptions = uiSchema?.["ui:options"] || {}; const isAdvanced = uiOptions.advanced === true; // Boolean fields (switches) render label inline const isBoolean = schema.type === "boolean"; return (
{displayLabel && label && !isBoolean && ( )} {isBoolean ? (
{displayLabel && label && ( )} {description && (

{description}

)}
{children}
) : ( <> {description && (

{description}

)} {children} )} {errors} {help}
); }