# new CrudFieldComponent(operation, name, type, value, disabled, label, placeholder, format, hidden, max, maxlength, min, minlength, pattern, readonly, required, step, formGroup, translatable)
The CrudFieldComponent is a versatile form field component that adapts to different input types and CRUD operations. It extends NgxCrudFormField to inherit form handling capabilities and implements lifecycle hooks to properly initialize, render, and clean up. This component supports various input types (text, number, date, select, etc.), validation rules, and styling options, making it suitable for building dynamic forms for create, read, update, and delete operations.
A dynamic form field component for CRUD operations.
Parameters:
Name | Type | Description |
---|---|---|
operation |
CrudOperations
|
The CRUD operation being performed (create, read, update, delete) |
name |
string
|
The field name, used as form control identifier |
type |
PossibleInputTypes
|
The input type (text, number, date, select, etc.) |
value |
string
|
number
|
Date
|
The initial value of the field |
disabled |
boolean
|
Whether the field is disabled |
label |
string
|
The display label for the field |
placeholder |
string
|
Placeholder text when field is empty |
format |
string
|
Format pattern for the field value |
hidden |
boolean
|
Whether the field should be hidden |
max |
number
|
Date
|
Maximum allowed value |
maxlength |
number
|
Maximum allowed length |
min |
number
|
Date
|
Minimum allowed value |
minlength |
number
|
Minimum allowed length |
pattern |
string
|
Validation pattern |
readonly |
boolean
|
Whether the field is read-only |
required |
boolean
|
Whether the field is required |
step |
number
|
Step value for number inputs |
formGroup |
FormGroup
|
The parent form group |
translatable |
StringOrBoolean
|
Whether field labels should be translated |
Example
<ngx-decaf-crud-field
operation="create"
name="firstName"
type="text"
label="<NAME>"
placeholder="<NAME>"
[value]="model.firstName"
[disabled]="model.readOnly">
Members
string
|
number
# uid
A unique identifier for the current record being displayed or manipulated. This is typically used in conjunction with the primary key for operations on specific records.
Unique identifier for the current record.