Veli Form Validation (v1.0.0)
A lightweight, zero-dependency form validation library that uses HTML attributes for validation rules.
Developed by GD3V
What is Veli?β
Veli is a modern JavaScript form validation library that lets you define validation rules directly in HTML attributes. No complex configuration, no dependenciesβjust HTML attributes like data-veli-rules and you're done.
<input
type="text"
id="fName"
data-veli-rules='{"name":"fName", "type":"text", "minWord": "2"}'
/>
Key Featuresβ
β
Zero Dependencies β Pure JavaScript, no external libraries
β
HTML-First β Define rules in HTML attributes
β
6 Field Types β text, password, email, tel, number, checkbox
β
3 Design Systems β classic, floating-label, ifta-label
β
Real-Time Validation β Instant feedback as users type
β
Multi-Language β Built-in English & French support
β
TypeScript Ready β Full type definitions included
β
Accessible β ARIA compliant, screen reader support
β
Framework Agnostic β Works with vanilla JS, React, Vue, Angular, etc.
β
Lightweight β ~15KB minified, ~5KB gzipped
Quick Startβ
1. Installβ
## node environment
npm install @gd3v/veli
2. Importβ
<!-- node environment -->
import "@gd3v/veli";
<!-- CDN -->
<script type="module" src="https://cdn.jsdelivr.net/npm/@gd3v/veli@latest/dist/veli.js"></script>
<!--
If you dowloaded the library with the download button on our website,
extract the zip file and
add the following script right before your </body>
-->
<script type="module" src="path-to-your-extracted-folder/veli.js"></script>
3. Create a Formβ
<form id="myForm" data-veli-design="classic" data-veli-lang="en">
<div class="veli-field-wrapper">
<label>Email</label>
<input
type="text"
id="fName"
data-veli-rules='{"name":"fName", "type":"text", "minWord": "2"}'
/>
<span class="veli-error"></span>
</div>
</form>
That's it! Validation is automatic.
Note: All forms that are to be validated should have an idβ
Supported Field Typesβ
| Type | Purpose | Key Options |
|---|---|---|
| text | General text input | minChar, maxChar, pattern |
| password | Secure password input | securityLevel, confirmWith |
| Email validation | provider (gmail, outlook, yahoo, any) | |
| tel | Phone number | country (see supported countries) |
| number | Numeric input | minValue, maxValue |
| checkbox | Checkboxes & agreements | required |
Design Systemsβ
Choose the visual style that fits your app:
Classicβ
Traditional form layout. Labels above inputs, clear and scannable.
Floating Labelβ
Modern SPA style. Labels animate above inputs on focus. Space-efficient.
IFTA Labelβ
Maximum accessibility. Fieldset-based with legend labels. Screen reader friendly.
Real-World Examplesβ
- Contact forms
- User registration
- Login pages
- Product orders
- Survey forms
- React/Vue components
Validation Responseβ
The library dispatches an event onCompleteValidation. We listern to this event to get the validation response.
<script type="module">
document
.getElementById("your form id")
.addEventListener("onCompleteValidation", (e) => {
const result = validationResponse["your form id"];
console.log(result);
});
</script>
Full Documentationβ
- Getting Started β Installation & setup
- Field Types β All validation options
- Design Systems β UI themes
- Examples β Real code samples
- API Reference β Complete API docs
Browser Supportβ
- β Chrome 90+
- β Firefox 88+
- β Safari 14+
- β Edge 90+
- β Mobile browsers (iOS Safari, Chrome Mobile)
Questions? Check the API Reference or see Examples for common patterns.