Validator

DaisyUI

Validator class changes the color of form elements to error or success based on input's validation rules.

Email Validator

Writing an invalid email address applies error color to the input. Valid email applies success color.

Enter valid email address
Password Requirement Validator

A multi-line hint with pattern validation.

Must be more than 8 characters, including At least one number At least one lowercase letter At least one uppercase letter
Code Example
use rsxui::components::Validator;
use rsx_macros::rsx;
// Email validator
let html = rsx! {
    <Validator hint="Enter valid email address">
        <input
            type="email"
            class="input validator"
            required
            placeholder="mail@site.com"
        />
    </Validator>
};
// Password validator with pattern
let html = rsx! {
    <Validator hint="Must be more than 8 characters...">
        <input
            type="password"
            class="input validator"
            required
            placeholder="Password"
            minlength="8"
            pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}"
        />
    </Validator>
};