Angular UI Components Documentation
Angular's reactive forms keep a form's state in your component: a FormGroup of FormControls with their values, validators and errors, built in code and bound to the template. The jQWidgets form components implement Angular's ControlValueAccessor, so <jqxInput>, <jqxCheckBox> and the other editors take a formControlName like a native input and report their value, touched state and validity to the form.
This guide builds a registration form with an email field, a user name with custom validation rules, and a terms check box, in a standalone Angular 22 app.
Components that work as form controls: jqxInput, jqxPasswordInput, jqxTextArea, jqxNumberInput, jqxMaskedInput, jqxFormattedInput, jqxComplexInput, jqxDateTimeInput, jqxCalendar, jqxCheckBox, jqxRadioButton, jqxSwitchButton, jqxSlider, jqxRating, jqxDropDownList, jqxComboBox, jqxListBox and jqxEditor.
ng new registration-form
cd registration-form
ng add jqwidgets-ng
ng add asks for a theme and adds the jQWidgets styles to angular.json.
The component imports ReactiveFormsModule and the jQWidgets components it uses. There is no NgModule: everything a standalone component needs goes in its imports.
import { Component } from '@angular/core';
import {
AbstractControl,
FormBuilder,
ReactiveFormsModule,
ValidationErrors,
ValidatorFn,
Validators
} from '@angular/forms';
import { jqxInputModule } from 'jqwidgets-ng/jqxinput';
import { jqxCheckBoxModule } from 'jqwidgets-ng/jqxcheckbox';
import { jqxButtonModule } from 'jqwidgets-ng/jqxbuttons';
@Component({
selector: 'app-root',
imports: [ReactiveFormsModule, jqxInputModule, jqxCheckBoxModule, jqxButtonModule],
templateUrl: './app.html',
styleUrl: './app.css'
})
export class App {
// …the form, below
}
inject(FormBuilder) gives the builder; nonNullable makes reset() return each control to its initial value instead of null. Each control has an initial value and its validators.
export class App {
private readonly fb = inject(FormBuilder).nonNullable;
readonly form = this.fb.group({
email: ['', [Validators.required, Validators.email]],
username: ['', [
Validators.required,
Validators.minLength(6),
Validators.maxLength(12),
matches(/[\d!@#$%^&*()_+\-=]/, 'digitOrSpecial'),
matches(/[A-Z]/, 'capital'),
matches(/[a-z]/, 'lowercase')
]],
terms: [false, Validators.requiredTrue]
});
}
The three rules for the user name share one validator factory, declared outside the class. A validator returns null when the value passes, or an object naming the error:
// Passes when the value matches the pattern; otherwise reports the error under `key`.
function matches(pattern: RegExp, key: string): ValidatorFn {
return (control: AbstractControl): ValidationErrors | null =>
pattern.test(control.value ?? '') ? null : { [key]: true };
}
The messages live in one table, and a method returns the messages for a field once the user has changed it:
export class App {
private readonly messages: Record<string, Record<string, string>> = {
email: {
required: 'The email is required.',
email: 'This is not a valid email.'
},
username: {
required: 'The user name is required.',
minlength: 'Use at least 6 characters.',
maxlength: 'Use at most 12 characters.',
digitOrSpecial: 'Include a digit or one of !@#$%^&*()_+-=',
capital: 'Include a capital letter.',
lowercase: 'Include a lower-case letter.'
}
};
errors(field: 'email' | 'username'): string[] {
const control = this.form.controls[field];
if (!control.dirty || !control.errors) return [];
return Object.keys(control.errors).map(e => this.messages[field][e]).filter(Boolean);
}
register(): void {
console.log('Registered', this.form.getRawValue());
}
clear(): void {
this.form.reset();
}
}
[formGroup] binds the form; each jQWidgets component takes the formControlName of its control. The new control flow blocks (@if, @for) show the messages.
<form [formGroup]="form" novalidate>
<h2>User registration</h2>
<label>
Email
<jqxInput formControlName="email" [width]="'100%'" [height]="36"></jqxInput>
</label>
@if (errors('email').length) {
<ul class="errors">
@for (message of errors('email'); track message) { <li>{{ message }}</li> }
</ul>
}
<label>
User name
<jqxInput formControlName="username" [width]="'100%'" [height]="36"></jqxInput>
</label>
@if (errors('username').length) {
<ul class="errors">
@for (message of errors('username'); track message) { <li>{{ message }}</li> }
</ul>
}
<jqxCheckBox formControlName="terms">I agree to the terms and conditions.</jqxCheckBox>
<div class="actions">
<jqxButton [disabled]="form.invalid" (onClick)="register()">Register</jqxButton>
<jqxButton (onClick)="clear()">Clear</jqxButton>
</div>
</form>
A little CSS for the layout, in src/app/app.css:
form { max-width: 360px; margin: 32px auto; display: grid; gap: 12px; font: 14px system-ui, sans-serif; }
label { display: grid; gap: 4px; }
.errors { margin: 0; padding: 8px 12px 8px 28px; border-radius: 4px; background: #fdecea; color: #a4262c; }
.actions { display: flex; gap: 8px; }
ng serve
Type in the fields: the messages appear as soon as a field is changed and disappear when it is valid, and Register stays disabled until the whole form is valid. Clear resets every jQWidgets component through the form.
The same components work with FormsModule and [(ngModel)] for simple forms:
<jqxInput [(ngModel)]="name" name="name"></jqxInput>
Next: Input getting started, jqxForm for forms built from a JSON template, and the live Angular demos.