HTML-First API
Use `data-ctrovalidate-rules` to define validation directly on your inputs. Keep logic clean and readable.
Lightweight, accessible-by-default, and zero-dependency. Define rules in HTML, handle the rest in JS.
Validation shouldn't be a chore. Ctrovalidate allows you to describe what you want, leaving the how to us.
<!-- Define rules directly in HTML -->
<input
type="email"
name="user_email"
data-ctrovalidate-rules="required|email"
data-ctrovalidate-on="input"
/>
<!-- Errors are handled automatically -->
<div class="error-container"></div>import { Ctrovalidate } from 'ctrovalidate';
// One line to initialize
const validator = new Ctrovalidate(document.querySelector('form'));
// Promise-based validation
const isValid = await validator.validate();Ctrovalidate is tool-agnostic and designed to fit perfectly into your existing stack.
| Frameworks | Styles | Tools |
|---|---|---|
| Next.js / React | Tailwind CSS | Vite / Webpack |
| Nuxt / Vue.js | CSS Modules | TypeScript |
| SvelteKit / Svelte | Vanilla CSS | JSDoc |
| Alpine.js / HTMX | Bootstrap | Rollup / Esbuild |
Join developers building accessible and performant web applications with Ctrovalidate.