Textarea

Textarea

import Textarea from "@kiwicom/orbit-components/lib/Textarea";
<Textarea />

Props

NameTypeDefaultDescription
dataAttrsObjectOptional prop for passing data-* attributes to the textarea DOM element.
dataTeststringOptional prop for testing purposes.
idstringSet id for Textarea
defaultValuestringSpecifies the default value of the Textarea. To be used with uncontrolled usage.
disabledbooleanIf true, the Textarea will be disabled.
errorReact.NodeThe error to display beneath the Textarea. See Functional specs
fullHeightbooleanfalseIf true, the Textarea will take 100 % of parent’s height.
helpReact.NodeThe help to display beneath the Textarea.
labelTranslationThe label for the Textarea. See Functional specs
maxLengthnumberSpecifies the maximum number of characters allowed.
namestringThe name for the Textarea.
onChangeevent => void \| PromiseFunction for handling onClick event.
onFocusevent => void \| PromiseFunction for handling onFocus event.
onBlurevent => void \| PromiseFunction for handling onBlur event.
placeholderTranslationStringThe placeholder of the Textarea.
reffuncProp for forwarded ref of the Textarea. See Functional specs
resizeenum"vertical"The resize option for Textarea.
rowsnumberSpecifies the height of the text area (in lines).
readOnlybooleanAdds readOnly to html textarea element.
requiredbooleanIf true, the label is displayed as required.
spaceAfterenumAdditional margin-bottom after component.
tabIndexstring \| numberSpecifies the tab order of an element
valuestringSpecifies the value of the Textarea. To be used with controlled usage.
helpClosablebooleantrueWhether to display help as a closable tooltip, or have it open only while the field is focused, same as error.

enum

resizespaceAfter
"vertical""none"
"none""smallest"
"small"
"normal"
"medium"
"large"
"largest"

Functional specs

class Component extends React.PureComponent<Props> {
componentDidMount() {
this.ref.current && this.ref.current.focus();
}
ref: { current: React.ElementRef<*> | null } = React.createRef();
render() {
return <Textarea ref={this.ref} />;
}
}