Textarea

Retrieve multi-line user input.

General

Basic usage.

disabled

Disable interactive textarea.

Type

Differentiate states by color.

get change

Capture changes in textarea.

With useInput

Use hooks to capture changes.

Imperative API

Update component in an uncontrolled way.

APIs

Textarea.Props[alias: Input.Textarea]

AttributeDescriptionTypeAccepted valuesDefault
valuetextarea valuestring--
initialValuetextarea valuestring--
placeholderplaceholderstring--
typecurrent typeTextareaTypesTextareaTypesdefault
readOnlynative attrboolean-false
disableddisable inputboolean-false
onChangechange event(e: React.ChangeEvent) => void--
resizeCSS attributeCSSResizeCSSResizenone
...native propsTextareaHTMLAttributes'form', 'id', 'className', ...-

useInput

type useInput = (initialValue: string) => {
  state: string
  setState: Dispatch<SetStateAction<string>>
  currentRef: MutableRefObject<string>
  reset: () => void
  bindings: {
    value: string
    onChange: (event: React.ChangeEvent<HTMLInputElement>) => void
  }
}

TextareaTypes

type TextareaTypes = 'default' | 'secondary' | 'success' | 'warning' | 'error'

CSSResize

type CSSResize = 'none' | 'both' | 'horizontal' | 'vertical' | 'initial' | 'inherit'