/** * FormFieldWrapper Live Demo * * This component demonstrates the FormFieldWrapper in action * You can view this by navigating to /examples/form-field-wrapper */ import { useForm } from 'react-hook-form'; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; import { FormFieldWrapper, formFieldPresets } from '@/components/ui/form-field-wrapper'; import { TooltipProvider } from '@/components/ui/tooltip'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; export function FormFieldWrapperDemo() { const { register, formState: { errors }, watch, handleSubmit } = useForm(); const onSubmit = (data: any) => { console.log('Form submitted:', data); alert('Check console for form data'); }; return (
FormFieldWrapper Demo Interactive demonstration of the unified form field component Basic Terminology Presets Advanced
{/* Basic Examples */}

Basic Field Types

These fields automatically show appropriate hints and validation

{/* Terminology Examples */}

Fields with Terminology

Hover over labels with icons to see terminology definitions

{/* Preset Examples */}

Using Presets

Common field configurations with one-line setup

{/* Advanced Examples */}

Advanced Features

Textareas, character counting, and custom hints

{/* Benefits Card */} Benefits
  • Consistency: All fields follow the same structure and styling
  • Less Code: ~50% reduction in form field boilerplate
  • Smart Defaults: Automatic hints based on field type
  • Built-in Terminology: Hover tooltips for technical terms
  • Easy Updates: Change hints in one place, updates everywhere
  • Type Safety: TypeScript ensures correct usage
); }