Textarea

Multi-line inputs for forms

Contents

Without validation

With warning border when nearing the limit

With warning border past the limit

With default validation

With dynamic validation on blur

With the counter sized like the error

With the counter sized like the error, showing the error

With dynamic validation on submit

Inputs in Max character
autoHideCounter ?: boolean = true

Hides max character counter when blurred out of field

counterMatchesErrorSize ?: boolean = false

Sizes the max character counter like the validation error text, so the two read as one status line when they swap

dynamicValidation ?: "submit" | "blur"

First validation happens only on blur/submit, and validates on keyup once an error exists

maxCharacter ?: number
maxCharacterPosition ?: TextareaMaxCharPosition = TextareaMaxCharPosition.LEFT
warning ?: boolean = false

Shows a warning border. The caller decides when to set this, e.g. when the content is nearing `maxCharacter`; the textarea does not detect that itself. The warning colour replaces the focus ring while focused. A validation error border takes precedence. While this is set: - the error border stays red when focused, instead of switching to the focus colour - going over `maxCharacter` shows the error border straight away, matching the red counter, without waiting for blur/submit - while focused and over `maxCharacter`, the "characters over limit" counter shows in place of the error message, which returns on blur

Also set in this example
control : FormControl<string>
placeholder ?: string = ''
Outputs
inputBlur ?: any = new EventEmitter<void>()
inputFocus ?: any = new EventEmitter<void>()
inputHandled ?: any = new EventEmitter<void>()
inputSelect ?: any = new EventEmitter<TextareaSelectEvent>()

Event emitted everytime a user highlights a text in the textarea