Skip to main content

Available Components

Mat Dynamic Form provides a comprehensive set of components for building dynamic forms in Angular. Each component is designed to work seamlessly with Angular’s reactive forms and Material Design.

Input Components

These components capture text and numeric data from users.

Input

Standard text input for single-line text entry with character limits and validation.

Textarea

Multi-line text input for longer content like comments or descriptions.

Input File

File upload component with drag-and-drop support and file type validation.

Selection Components

These components allow users to choose from predefined options.

Dropdown

Single or multi-select dropdown with support for async data loading.

Radio Group

Mutually exclusive radio button groups for clear choice selection.

Checkbox

Boolean checkbox for toggleable options and agreements.

Date and Time Components

These components handle date and time input with built-in pickers.

Date Picker

Date selection with Material Design calendar picker.

Date Time Picker

Combined date and time selection with customizable formats.

Time Picker

Time-only selection with clock picker interface.

Action Components

These components trigger actions and form submissions.

Button

Action buttons with built-in form validation support.

Custom Component

Embed your own Angular components within the dynamic form.

Common Features

All components share these common capabilities:

Validation Support

Every component supports both synchronous and asynchronous validation using Angular’s built-in validators or custom validation functions.
import { Validators } from '@angular/forms';

const field = new Input('email', 'Email').apply({
  validator: [Validators.required, Validators.email],
  errorMessage: 'Please enter a valid email'
});

Event Handling

Attach custom actions to respond to user interactions:
const field = new Input('search', 'Search').apply({
  action: {
    type: 'valueChange',
    onEvent: (param) => {
      console.log('Value changed:', param.event);
    }
  }
});

Material Design Icons

Add Material icons to enhance visual clarity:
const field = new Input('username', 'Username').apply({
  icon: 'person'
});

Responsive Layout

Control component width with the singleLine property:
// Takes full row width
const field = new Input('description', 'Description').apply({
  singleLine: true
});

Helper Text

Provide contextual guidance with hints:
const field = new Input('password', 'Password').apply({
  hint: 'Must be at least 8 characters'
});

The apply() Method

All components support the fluent apply() method for clean, readable configuration:
const input = new Input('name', 'Full Name')
  .apply({
    icon: 'person',
    validator: Validators.required,
    hint: 'Enter your legal name',
    maxCharCount: 100,
    autoFocus: true
  });
This is equivalent to setting properties individually but more concise and chainable.

Component Properties Reference

Common Properties

These properties are available on all components:
id
string
required
Unique identifier for the component. Used to access values and controls.
placeholder
string
Placeholder text displayed when the field is empty.
icon
string
Material icon name to display alongside the field.
disabled
boolean
default:"false"
Whether the field is disabled and non-interactive.
singleLine
boolean
default:"false"
Whether the field takes up a full row in the form grid.
validator
ValidatorFn | ValidatorFn[]
Synchronous validators to apply to the field.
asyncValidator
AsyncValidatorFn
Asynchronous validators for server-side validation.
errorMessage
string
Custom error message displayed when validation fails.
hint
string
Helper text displayed below the field.
autoFocus
boolean
default:"false"
Whether the field receives focus when the form loads.
action
Action | Action[]
Event handlers for user interactions. See Actions.

Next Steps

Explore individual component pages for detailed usage examples, properties, and best practices:

Input

Dropdown

Checkbox

Radio Group

Date Picker

Date Time Picker

Time Picker

Input File

Textarea

Button

Custom Component

Looking for advanced features? Check out the Concepts section to learn about node inheritance, dynamic form manipulation, and more.

Build docs developers (and LLMs) love