Text Area
The text area component allows users to enter in multi-line text into a resizable box.
You can create a text area component as so:
FormTextArea("notes")Common Methods
For a list of common field component methods, see here.
Placeholder
You can define the placeholder text inside your form text area using the Placeholder method. (This is not a default value and is never submitted with your form. For default values see here)
// static
FormTextArea("notes").
Placeholder("Please write your notes here!")
// callback
FormTextArea("notes").
PlaceholderFn(
func (ctx FieldContext) string {
return "Place write your notes here!"
}
)Resizeable
You can deceide whether the user can resize your text area box as so:
// static
FormTextArea("notes").
Resizable()
// callback
FormTextArea("notes").
ResizeableFn(
func (ctx FieldContext) bool {
return false
}
)Max Length
You can define the maximum length requirement for your text input field as so:
// static
FormTextArea("notes").
MaxLength(100)
// callback
FormTextArea("notes").
MaxLengthFn(
func (ctx FieldContext) int {
return 200
}
)FE validation
Max Length is front-end validation. Please apply the relevant RuleMaxCount to ensure this rule is upheld server side.
Min Length
You can define the minimum length requirement for your text input field as so:
// static
FormTextArea("notes").
MinLength(10)
// callback
FormTextArea("notes").
MinLength(
func (ctx FieldContext) int {
return 10
}
)FE validation
Min Length is front-end validation. Please apply the relevant RuleMinCount to ensure this rule is upheld server side.
SpellCheck
You can define the spellchecking options for your text area as so:
// static
FormTextArea("notes").
SpellCheck()
// callback
FormTextArea("notes").
SpellCheckFn(
func (ctx FieldContext) bool {
return false
}
)