borghei/Claude-Skills / engineering/senior-frontend
senior-frontend
VerifiedScaffold Next.js 16 or React + Vite 8 apps, generate components with tests and stories, and flag heavy bundle dependencies. Use when starting a React project, adding components or hooks, or reviewing frontend code or performance.
assets/templates/scaffold/files/form_field.tsx
View on GitHubimport { forwardRef, useId, type InputHTMLAttributes } from 'react';
import { cn } from '@/lib/utils';
interface FormFieldProps extends InputHTMLAttributes<HTMLInputElement> {
label: string;
error?: string;
hint?: string;
}
// Works with react-hook-form:
// <FormField label="Email" {...register('email')} error={errors.email?.message} />
export const FormField = forwardRef<HTMLInputElement, FormFieldProps>(
({ label, error, hint, id, className, ...props }, ref) => {
const generatedId = useId();
const inputId = id ?? generatedId;
const hintId = `${inputId}-hint`;
const errorId = `${inputId}-error`;
const describedBy = [hint ? hintId : null, error ? errorId : null].filter(Boolean).join(' ');
return (
<div className="space-y-1">
<label htmlFor={inputId} className="block text-sm font-medium">
{label}
</label>
<input
id={inputId}
ref={ref}
aria-invalid={error ? true : undefined}
aria-describedby={describedBy || undefined}
className={cn(
'flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm',
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',
error && 'border-destructive focus-visible:ring-destructive',
className
)}
{...props}
/>
{hint && (
<p id={hintId} className="text-sm text-muted-foreground">
{hint}
</p>
)}
{error && (
<p id={errorId} role="alert" className="text-sm text-destructive">
{error}
</p>
)}
</div>
);
}
);
FormField.displayName = 'FormField';
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |