The Textarea component allows you to easily create multi-line text inputs.
const Example = () => {
return <TextArea h={20} placeholder="Text Area Placeholder" w={{
base: "70%",
md: "25%"
}} />;
};
Invalid and Disabled TextArea
const Example = () => {
return <Stack space={2.5} w={{
base: "70%",
md: "25%"
}}>
<Box w="100%">
<Text mb="4" bold fontSize="lg">
Invalid TextArea
</Text>
<TextArea aria-label="t1" numberOfLines={4} placeholder="Invalid TextArea" isInvalid _dark={{
placeholderTextColor: "gray.300"
}} mb="5" />
<Divider />
</Box>
<Box>
<Text bold fontSize="lg" mb="4">
Disabled TextArea
</Text>
<TextArea aria-label="t1Disabled" placeholder="Disabled TextArea" isDisabled />
</Box>
</Stack>;
};
Value Controlled TextArea
const Example = () => {
const [textAreaValue, setTextAreaValue] = useState("Value Controlled");
const demoValueControlledTextArea = e => {
setTextAreaValue(e.currentTarget.value);
};
return <TextArea value={textAreaValue} onChange={demoValueControlledTextArea} w={{
base: "70%",
md: "25%"
}} />;
};
TextArea implements
,
,
,
,
,
,
,
,
,
,
Maps to react-native TextInput's numberOfLines.
NativeBase ships with a default theme for each component. Check out the default theme of the textArea
.
Info:
We can easily extend the textArea component theme using extendTheme function as described in the documentation .