Certainly! Below is a unique and professional user interface (UI) design and implementation for a law firm intake form component in a Next.js application. The design emphasizes:
Professional Aesthetic : Clean typography, subtle color palette, and structured layout.
Visual Distinction : Card-based layout with floating labels and a modern searchable select.
Responsiveness : Mobile-first design with adaptive layout.
Accessibility : Semantic HTML, proper labeling, and keyboard navigation support.
🧩 Technologies Used
Next.js (React-based framework)
Tailwind CSS (for utility-first styling)
Headless UI + Downshift (for accessible, searchable select)
React Hook Form (for form state management and validation)
📁 File Structure
code Copy code
components/
└── IntakeForm.tsx
pages/
└── intake.tsx
styles/
└── globals.css
✅ IntakeForm Component (components/IntakeForm.tsx)
tsx Copy code
'use client';
import { useState } from 'react';
import { useForm } from 'react-hook-form';
import counties from '../data/counties'; // Assume this is a list of counties
import { Combobox } from '@headlessui/react';
type FormData = {
fullName: string;
email: string;
phone: string;
county: string;
description: string;
};
export default function IntakeForm() {
const {
register,
handleSubmit,
setValue,
formState: { errors },
} = useForm<FormData>();
const [selectedCounty, setSelectedCounty] = useState('');
const [query, setQuery] = useState('');
const filteredCounties =
query === ''
? counties
: counties.filter((county) =>
county.toLowerCase().includes(query.toLowerCase())
);
const onSubmit = (data: FormData) => {
console.log('Form submitted:', data);
// Handle submission logic
};
return (
<div className="max-w-2xl mx-auto p-6 bg-white shadow-xl rounded-lg mt-10">
<h1 className="text-2xl font-semibold text-gray-800 mb-6 border-b pb-2">
Client Intake Form
</h1>
<form onSubmit={handleSubmit(onSubmit)} className="space-y-6">
{/* Full Name */}
<div className="relative">
<input
type="text"
id="fullName"
{...register('fullName', { required: true })}
className="peer w-full border border-gray-300 rounded-md px-4 pt-6 pb-2 focus:outline-none focus:ring-2 focus:ring-blue-500"
placeholder=" "
/>
<label
htmlFor="fullName"
className="absolute left-4 top-2 text-sm text-gray-600 transition-all peer-placeholder-shown:top-4 peer-placeholder-shown:text-base peer-placeholder-shown:text-gray-400 peer-focus:top-2 peer-focus:text-sm peer-focus:text-blue-600"
>
Full Name
</label>
{errors.fullName && (
<p className="text-red-500 text-sm mt-1">Full name is required.</p>
)}
</div>
{/* Email */}
<div className="relative">
<input
type="email"
id="email"
{...register('email', { required: true })}
className="peer w-full border border-gray-300 rounded-md px-4 pt-6 pb-2 focus:outline-none focus:ring-2 focus:ring-blue-500"
placeholder=" "
/>
<label
htmlFor="email"
className="absolute left-4 top-2 text-sm text-gray-600 transition-all peer-placeholder-shown:top-4 peer-placeholder-shown:text-base peer-placeholder-shown:text-gray-400 peer-focus:top-2 peer-focus:text-sm peer-focus:text-blue-600"
>
Email Address
</label>
{errors.email && (
<p className="text-red-500 text-sm mt-1">Email is required.</p>
)}
</div>
{/* Phone */}
<div className="relative">
<input
type="tel"
id="phone"
{...register('phone', { required: true })}
className="peer w-full border border-gray-300 rounded-md px-4 pt-6 pb-2 focus:outline-none focus:ring-2 focus:ring-blue-500"
placeholder=" "
pattern="^[0-9+\-\s()]*$"
/>
<label
htmlFor="phone"
className="absolute left-4 top-2 text-sm text-gray-600 transition-all peer-placeholder-shown:top-4 peer-placeholder-shown:text-base peer-placeholder-shown:text-gray-400 peer-focus:top-2 peer-focus:text-sm peer-focus:text-blue-600"
>
Phone Number
</label>
{errors.phone && (
<p className="text-red-500 text-sm mt-1">Phone number is required.</p>
)}
</div>
{/* County Select */}
<div className="relative">
<Combobox
value={selectedCounty}
onChange={(value) => {
setSelectedCounty(value);
setValue('county', value);
}}
>
<Combobox.Label className="block text-sm font-medium text-gray-700 mb-1">
County
</Combobox.Label>
<div className="relative">
<Combobox.Input
className="w-full border border-gray-300 rounded-md px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"
onChange={(event) => setQuery(event.target.value)}
displayValue={(county: string) => county}
placeholder="Search county..."
/>
<Combobox.Options className="absolute z-10 mt-1 w-full bg-white border border-gray-300 rounded-md shadow-lg max-h-60 overflow-auto">
{filteredCounties.length === 0 && query !== '' ? (
<div className="p-2 text-gray-500">No counties found.</div>
) : (
filteredCounties.map((county) => (
<Combobox.Option
key={county}
value={county}
className={({ active }) =>
`cursor-pointer select-none px-4 py-2 ${
active ? 'bg-blue-100 text-blue-900' : 'text-gray-900'
}`
}
>
{county}
</Combobox.Option>
))
)}
</Combobox.Options>
</div>
</Combobox>
</div>
{/* Case Description */}
<div className="relative">
<textarea
id="description"
{...register('description', { required: true })}
rows={4}
className="peer w-full border border-gray-300 rounded-md px-4 pt-6 pb-2 focus:outline-none focus:ring-2 focus:ring-blue-500 resize-none"
placeholder=" "
/>
<label
htmlFor="description"
className="absolute left-4 top-2 text-sm text-gray-600 transition-all peer-placeholder-shown:top-4 peer-placeholder-shown:text-base peer-placeholder-shown:text-gray-400 peer-focus:top-2 peer-focus:text-sm peer-focus:text-blue-600"
>
Brief Case Description
</label>
{errors.description && (
<p className="text-red-500 text-sm mt-1">Description is required.</p>
)}
</div>
{/* Submit Button */}
<div className="text-right">
<button
type="submit"
className="bg-blue-600 text-white px-6 py-2 rounded-md hover:bg-blue-700 transition"
>
Submit
</button>
</div>
</form>
</div>
);
}
📄 Page Integration (pages/intake.tsx)
tsx Copy code
import IntakeForm from '../components/IntakeForm';
export default function IntakePage() {
return (
<main className="min-h-screen bg-gray-100 py-10 px-4">
<IntakeForm />
</main>
);
}
📦 Sample County Data (data/counties.ts)
ts Copy code
const counties = [
'Alameda',
'Contra Costa',
'Los Angeles',
'Orange',
'San Diego',
'San Francisco',
'Santa Clara',
'Sacramento',
'Fresno',
'Ventura',
// Add more as needed
];
export default counties;
🎨 Styling (Tailwind CSS)
Ensure Tailwind is configured in your tailwind.config.js and imported in styles/globals.css.
css Copy code
/* styles/globals.css */
@tailwind base;
@tailwind components;
@tailwind utilities;
🧑⚖️ Design Highlights
Floating Labels : Improves clarity and reduces clutter.
Searchable County Select : Enhances usability for long lists.
Card Layout : Gives a professional, focused appearance.
Accessible Components : Uses Headless UI for keyboard and screen reader support.
Responsive : Works well on mobile, tablet, and desktop.
✅ Accessibility Features
Labels are associated with inputs.
Keyboard navigation supported in Combobox.
Color contrast meets WCAG standards.
Error messages are screen-reader friendly.
🧪 Optional Enhancements
Add form validation with yup or zod.
Integrate with backend API for submission.
Add loading state and success confirmation.
Let me know if you'd like a version using Material UI or Chakra UI instead!