Form Controls

Reference for all Spiderly form input components — text, number, dropdown, autocomplete, file upload, and more.

Overview

Spiderly provides 13 form control components that wrap PrimeNG inputs with consistent labeling, validation display, and form integration. All controls are designed to work with SpiderlyFormControl and are used by the generated detail pages.

Every control extends BaseControl and shares a common set of inputs documented below.

Shared Inputs (BaseControl)

All form controls inherit these inputs:

InputTypeDefaultDescription
controlSpiderlyFormControl<any>The reactive form control bound to this field
disabledbooleanfalseDisables the control
labelstringnullCustom label text (overrides the control's translated label)
placeholderstring''Input placeholder text
showLabelbooleantrueWhether to render the label
showRequiredbooleantrueWhether to show the required indicator
showTooltipbooleanfalseWhether to show a tooltip icon
tooltipTextstringnullTooltip content

spiderly-textbox

Single-line text input.

InputTypeDefaultDescription
showButtonbooleanfalseShows an icon button appended to the input
buttonIconstringPrimeIcons class for the button (e.g. 'pi pi-search')
OutputPayloadDescription
onButtonClickvoidFires when the appended button is clicked
<spiderly-textbox
  [control]="form.getControl('name')"
  [showButton]="true"
  buttonIcon="pi pi-search"
  (onButtonClick)="onSearch()"
></spiderly-textbox>

spiderly-textarea

Multi-line text input. No additional inputs beyond shared inputs.

<spiderly-textarea [control]="form.getControl('description')"></spiderly-textarea>

spiderly-password

Password input with optional strength meter.

InputTypeDefaultDescription
showPasswordStrengthbooleanfalseShows a password strength meter below the field
<spiderly-password
  [control]="form.getControl('password')"
  [showPasswordStrength]="true"
></spiderly-password>

spiderly-number

Numeric input with optional spinner buttons and decimal support.

InputTypeDefaultDescription
prefixstringText prefix shown inside the input (e.g. '$')
showButtonsbooleantrueShows increment/decrement spinner buttons
decimalbooleanWhether to allow decimal input
maxFractionDigitsnumber0Maximum number of decimal places
<spiderly-number
  [control]="form.getControl('price')"
  prefix="$"
  [decimal]="true"
  [maxFractionDigits]="2"
></spiderly-number>

spiderly-dropdown

Single-selection dropdown. Extends BaseDropdownControl which adds options, showAddon, addonIcon, and onButtonClick.

InputTypeDefaultDescription
optionsNamebook[]Selectable options ({"{ id, displayName }"})
isBooleanPickerbooleanfalseAuto-populates with True/False/Empty options
OutputPayloadDescription
onChangeDropdownChangeEventFires when the selection changes
<spiderly-dropdown
  [control]="form.getControl('categoryId')"
  [options]="categories"
  (onChange)="onCategoryChange($event)"
></spiderly-dropdown>

spiderly-multiselect

Multi-selection dropdown. Extends BaseDropdownControl.

InputTypeDefaultDescription
optionsNamebook[]Selectable options
<spiderly-multiselect
  [control]="form.getControl('tagIds')"
  [options]="tags"
></spiderly-multiselect>

spiderly-autocomplete

Searchable single-select with lazy loading. Extends BaseAutocompleteControl.

InputTypeDefaultDescription
optionsNamebook[]Filtered options (update on onTextInput)
showClearbooleantrueShows a clear button
displayNamestringInitial display text when the value is already set
OutputPayloadDescription
onTextInputAutoCompleteCompleteEventFires when the user types — use to load filtered options
<spiderly-autocomplete
  [control]="form.getControl('authorId')"
  [options]="authorOptions"
  [displayName]="authorDisplayName"
  (onTextInput)="searchAuthors($event)"
></spiderly-autocomplete>

spiderly-multiautocomplete

Searchable multi-select. Extends BaseAutocompleteControl.

OutputPayloadDescription
onTextInputAutoCompleteCompleteEventFires when the user types — use to load filtered options
<spiderly-multiautocomplete
  [control]="form.getControl('reviewerIds')"
  [options]="reviewerOptions"
  (onTextInput)="searchReviewers($event)"
></spiderly-multiautocomplete>

spiderly-checkbox

Boolean input.

InputTypeDefaultDescription
initializeToFalsebooleanfalseSets the control value to false on init
inlineLabelbooleanfalseRenders the label inline (to the right of the checkbox)
OutputPayloadDescription
onChangeCheckboxChangeEventFires when the value changes
<spiderly-checkbox
  [control]="form.getControl('isActive')"
  [initializeToFalse]="true"
  [inlineLabel]="true"
></spiderly-checkbox>

spiderly-calendar

Date/datetime picker.

InputTypeDefaultDescription
showTimebooleanfalseShows time picker in addition to date
<spiderly-calendar
  [control]="form.getControl('publishedAt')"
  [showTime]="true"
></spiderly-calendar>

spiderly-colorpicker

Color picker with optional hex text input.

InputTypeDefaultDescription
showInputTextFieldbooleantrueShows a hex text input alongside the color swatch
<spiderly-colorpicker [control]="form.getControl('themeColor')"></spiderly-colorpicker>

spiderly-editor

Rich text editor (Quill-based) with optional image upload.

InputTypeDefaultDescription
uploadImageMethod(formData: FormData) => Observable<string>Callback for uploading images; the returned URL is inserted into the editor
objectIdnumber0ID prepended to the filename when uploading images
<spiderly-editor
  [control]="form.getControl('content')"
  [uploadImageMethod]="uploadImage"
  [objectId]="entityId"
></spiderly-editor>

spiderly-file

File upload with validation.

InputTypeDefaultDescription
acceptedFileTypesstring[]['image/*']MIME types or extensions the input accepts
maxFileSizenumber20_000_000Maximum file size in bytes (20 MB)
imageWidthnumber0Expected image width in pixels (0 = no constraint)
imageHeightnumber0Expected image height in pixels (0 = no constraint)
multiplebooleanfalseAllow selecting multiple files
objectIdnumberID prepended to the uploaded filename
fileDatastringExisting file data for pre-populating (base64 or Cloudinary URL)
isCloudinaryFileDatabooleantrueWhether fileData is a Cloudinary URL or a base64 string
OutputPayloadDescription
onFileSelectedSpiderlyFileSelectEventFires when a file is selected
onFileRemovednullFires when the file is removed

SpiderlyFileSelectEvent contains: file (File), formData (FormData ready to POST), width and height (for images).

<spiderly-file
  [control]="form.getControl('profilePicture')"
  [objectId]="entityId"
  [acceptedFileTypes]="['image/*']"
  [maxFileSize]="5000000"
  [imageWidth]="200"
  [imageHeight]="200"
  [fileData]="profilePictureData"
  [isCloudinaryFileData]="false"
  (onFileSelected)="onProfilePictureSelected($event)"
  (onFileRemoved)="onProfilePictureRemoved()"
></spiderly-file>

Form Framework

Spiderly extends Angular's reactive forms with typed wrappers that integrate with the validation and code generation pipeline.

SpiderlyFormControl<T>

Extends Angular FormControl<T>. Created automatically by the generated validators service.

PropertyTypeDescription
labelstringInternal control name
labelForDisplaystringTranslated label used by controls
requiredbooleanWhether the control has a required validator
typestringType hint: 'number', 'Date', 'string', 'Namebook[]', etc.

Constructor defaults updateOn to 'blur' for performance. getRawValue() returns the value even when the control is disabled.

SpiderlyFormGroup<T>

Extends Angular FormGroup with type-safe control access.

Method / PropertyTypeDescription
getControl(name)SpiderlyFormControlType-safe accessor for a control by field name
getRawValue()TReturns all values including disabled controls
targetClassConstructor<T>Constructor reference for the entity type
saveObservableMethod(body) => Observable<any>Optional method for saving this form group independently
const title = this.form.getControl('title');
console.log(title.value, title.required, title.labelForDisplay);

SpiderlyFormArray<T>

Extends Angular FormArray for managing ordered lists of form groups (e.g., complex M2M relationships).

Method / PropertyTypeDescription
addNewFormGroup(index)voidInserts a new blank form group at the given index
getFormGroups()SpiderlyFormGroup<T>[]Returns child controls as typed form groups
getCrudMenuForOrderedData()MenuItem[]Returns context menu items: Remove, Add Above, Add Below
disableAllFormControls()voidDisables every control in all child form groups
enableAllFormControls()voidEnables every control in all child form groups
labelstringInternal label name
labelForDisplaystringTranslated label
requiredbooleanWhether the array is required