Tailwind Plugin
Applies Tailwind CSS utility classes to form fields based on their validation state.
Options
| Option | Type | Default | Description |
|---|---|---|---|
validClass | string | "" | Space-separated Tailwind classes applied when the field is valid |
invalidClass | string | "" | Space-separated Tailwind classes applied when the field is invalid |
Playground
Notes
- The
Tailwindplugin has no default classes. Always passvalidClassandinvalidClassoptions. Also add theMessageplugin to show error text. - Both
validClassandinvalidClassdefault to""— you must provide class names for the plugin to have any visual effect. - Supports multiple space-separated classes:
"ring-2 ring-green-500 border-green-500". - Classes are added to the
<input>element directly. - On
uninstall(), all validation classes are removed.