feat(auto-form): add new fields and form files to AutoForm component
Added several files to the AutoForm component for better form functionality including a file for each type of input field (checkbox, date, enum, file, number, radio-group, switch, etc). Managed the configurations in a separate file and handled dependencies to control form behaviours. This commit enhances form handling capabilities and simplifies the process for creating versatile forms.
This commit is contained in:
23
src/components/auto-form/common/label.tsx
Normal file
23
src/components/auto-form/common/label.tsx
Normal file
@@ -0,0 +1,23 @@
|
||||
import { FormLabel } from "@/components/ui/form";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
function AutoFormLabel({
|
||||
label,
|
||||
isRequired,
|
||||
className,
|
||||
}: {
|
||||
label: string;
|
||||
isRequired: boolean;
|
||||
className?: string;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<FormLabel className={cn(className)}>
|
||||
{label}
|
||||
{isRequired && <span className="text-destructive"> *</span>}
|
||||
</FormLabel>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default AutoFormLabel;
|
||||
Reference in New Issue
Block a user