Textarea

Textarea.

Examples

Basic Usage

Simplest of usage.

expand codeexpand code
import { Component } from '@angular/core';
import { SFSchema, SFTextareaWidgetSchema } from '@delon/form';
import { NzMessageService } from 'ng-zorro-antd/message';

@Component({
  selector: 'form-textarea-simple',
  template: ` <sf [schema]="schema" (formSubmit)="submit($event)"></sf> `,
})
export class FormTextareaSimpleComponent {
  schema: SFSchema = {
    properties: {
      remark: {
        type: 'string',
        title: '描述',
        ui: {
          widget: 'textarea',
          autosize: { minRows: 2, maxRows: 6 },
          change: val => console.log('change', val),
          focus: ev => console.log('focus', ev),
          blur: ev => console.log('blur', ev),
        } as SFTextareaWidgetSchema,
      },
    },
  };

  constructor(private msg: NzMessageService) {}

  submit(value: {}): void {
    this.msg.success(JSON.stringify(value));
  }
}

API

schema

PropertyDescriptionTypeDefault
[maxLength]Maximum length of the inputnumber-
[readOnly]Whether to disable the stateboolean-

ui

PropertyDescriptionTypeDefault
[size]Size of the nz-inputstring-
[placeholder]placeholder of the inputstring-
[autosize]height autosize feature, can be set to boolean or an object { minRows: 2, maxRows: 6 }boolean丨{ minRows: number, maxRows: number }true
[borderless]Whether hide borderbooleanfalse
[change]The content event for the Input.(val: string) => void-
[focus]The focus event for the Input.(e: FocusEvent) => void-
[blur]The blur event for the Input.(e: FocusEvent) => void-