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.
idstringSets the id for the 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.
maxLengthnumberSpecifies the maximum number of characters allowed.
namestringThe name for the Textarea.
onChangeevent => void \| PromiseFunction for handling onChange event.
onFocusevent => void \| PromiseFunction for handling onFocus event.
onBlurevent => void \| PromiseFunction for handling onBlur event.
placeholderTranslationStringThe placeholder text for 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 the readOnly attribute to the 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.
ariaLabelstringOptional prop to set the aria-label attribute value.
ariaLabelledbystringOptional prop to set the aria-labelledby attribute value.

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} />;
}
}