--- title: Validator desc: Validator class changes the color of form elements to error or success based on input's validation rules. layout: components classnames: component: - class: validator desc: For input, select, textarea part: - class: validator-hint desc: for the hint text that appears after the input if it's invalid --- ### ~Validator #### writing an invalid email address applies error color to the input. Valid email address applies success color.
```html ``` ### ~Validator and validator-hint #### If value is invalid, a hint text appears below the input.
Enter valid email address
```html
Enter valid email address
``` > :INFO: > > `validator-hint` class will be invisible if it comes after a `validator` class, then if the input is invalid, `validator-hint` will get visible. > `validator-hint` still occupies space even if it's invisible because we don't want a layout shift when the hint appears. > If you prefer to hide the hint when it's not visible, add `hidden` class to `validator-hint`. It will take no space when it's hidden, and if input is invalid, it will appear and take space. ### ~Password requirement validator

Must be more than 8 characters, including
At least one number
At least one lowercase letter
At least one uppercase letter

```html

Must be more than 8 characters, including
At least one number
At least one lowercase letter
At least one uppercase letter

``` ### ~Username requirement validator

Must be 3 to 30 characters
containing only letters, numbers or dash

```html

Must be 3 to 30 characters
containing only letters, numbers or dash

``` ### ~Phone Number requirement validator

Must be 10 digits

```html

Must be 10 digits

``` ### ~URL input requirement validator

Must be valid URL

```html

Must be valid URL

``` ### ~Date input requirement validator

Must be 2025

```html

Must be 2025

``` ### ~Number input requirement validator

Must be between be 1 to 10

```html

Must be between be 1 to 10

``` ### ~Checkbox requirement validator

Required

```html

Required

``` ### ~Toggle requirement validator

Required

```html

Required

``` ### ~Select requirement validator #### Click the button before picking an option to see the error color.

Required

```html

Required

```