forms-validation
БесплатноБез исполняемых скриптовНе проверенMUI form patterns with validation and library integration
от TheLobbi★ 22 звезды на GitHubОб этом скилле
MUI Forms and Validation
Controlled vs Uncontrolled Patterns
Controlled (recommended for most cases)
State lives in React. Every keystroke triggers a re-render; use for small-to-medium forms.
function ControlledForm() {
const [name, setName] = React.useState('');
const [email, setEmail] = React.useState('');
const [error, setError] = React.useState<string | null>(null);
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
if (!email.includes('@')) {
setError('Enter a valid email address');
return;
}
// submit...
};
return (
<Box component="form" onSubmit={handleSubmit} noValidate>
<TextField
label="Full name"
value={name}
onChange={(e) => setName(e.target.value)}
fullWidth
margin="normal"
/>
<TextField
label="Email"
type="email"
value={email}
onChange={(e) => {
setEmail(e.target.value);
setError(null); // clear error on change
}}
error={!!error}
helperText={error}
fullWidth
margin="normal"
/>
<Button type="submit" variant="contained" fullWidth sx={{ mt: 2 }}>
Submit
</Button>
</Box>
);
}
Uncontrolled with refs
Use for very large forms where performance matters, or when integrating with non-React code.
function UncontrolledForm() {
const nameRef = React.useRef<HTMLInputElement>(null);
const emailRef = React.useRef<HTMLInputElement>(null);
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
const data = {
name: nameRef.current?.value,
email: emailRef.current?.value,
};
// submit data
};
return (
<Box component="form" onSubmit={handleSubmit}>
<TextField label="Name" inputRef={nameRef} fullWidth margin="normal" />
<TextField label="Email" type="email" inputRef={emailRef} fullWidth margin="normal" />
<Button type="submit" variant="contained">Submit</Button>
</Box>
);
}
TextField Error and Helper Text Patterns
// error flag turns label and border red; helperText shows message below
<TextField
label="Password"
type="password"
error={password.length > 0 && password.length < 8}
helperText={
password.length > 0 && password.length < 8
? 'Password must be at least 8 characters'
: 'Use a strong, unique password'
}
value={password}
onChange={(e) => setPassword(e.target.value)}
fullWidth
/>
// Character counter in helperText
<TextField
label="Bio"
multiline
rows={3}
value={bio}
onChange={(e) => setBio(e.target.value)}
inputProps={{ maxLength: 200 }}
helperText={`${bio.length}/200`}
FormHelperTextProps={{ sx: { textAlign: 'right' } }}
fullWidth
/>
FormControl / FormLabel / FormHelperText (Non-TextField)
Use these primitives for custom inputs like checkbox groups or radio groups where
TextField does not apply.
import FormControl from '@mui/material/FormControl';
import FormLabel from '@mui/material/FormLabel';
import FormGroup from '@mui/material/FormGroup';
import FormControlLabel from '@mui/material/FormControlLabel';
import FormHelperText from '@mui/material/FormHelperText';
import Checkbox from '@mui/material/Checkbox';
function NotificationPreferences() {
const [prefs, setPrefs] = React.useState({ email: true, sms: false, push: true });
const [error, setError] = React.useState(false);
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const updated = { ...prefs, [e.target.name]: e.target.checked };
setPrefs(updated);
setError(!Object.values(updated).some(Boolean)); // at least one required
};
return (
<FormControl error={error} component="fieldset" variant="standard">
<FormLabel component="legend">Notification channels</FormLabel>
<FormGroup>
<FormControlLabel
control={<Checkbox checked={prefs.email} onChange={handleChange} name="email" />}
label="Email notifications"
/>
<FormControlLabel
control={<Checkbox checked={prefs.sms} onChange={handleChange} name="sms" />}
label="SMS notifications"
/>
<FormControlLabel
control={<Checkbox checked={prefs.push} onChange={handleChange} name="push" />}
label="Push notifications"
/>
</FormGroup>
{error && <FormHelperText>Select at least one notification channel.</FormHelperText>}
</FormControl>
);
}
React Hook Form + MUI
React Hook Form is the recommended library for complex forms. Use the Controller
component to integrate with MUI controlled inputs. Avoid spreading register() directly
on MUI inputs — use Controller instead.
import { useForm, Controller } from 'react-hook-form';
import { zodResolver } from '@hookform/resolvers/zod';
import * as z from 'zod';
const schema = z.object({
firstName: z.string().min(1, 'First nam
Установить forms-validation в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGlobGrepWriteEditFAQ
Что делает скилл forms-validation?
MUI form patterns with validation and library integration
Как установить скилл forms-validation?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл forms-validation запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic