Skip to main content

Input - TextArea

#Input - TextInput component

Effect demonstration

1. Only one input box

<Input placeholder="Please enter your name" />
input-ios1.png

2. Input box with labels and left and right icons

<Input
value={value}
onChange={setValue}
label="name"
placeholder="Please enter your name"
leftIcon={<SvgIcon name="eyeopen" color="green" size={28} />}
rightIcon={<SvgIcon name="ellipsis" color="red" size={28} />}
/>
input-ios2.png

3. The label is above the input box

<Input
label="Name"
placeholder="Please enter your name"
labelPosition="top"
leftIcon={<SvgIcon name="bells" size={28} color="green" />}
/>
input-ios3.png

4. With colon and required mark

<Input
colon
required
value={value}
onChange={setValue}
label="search"
placeholder="Please enter here..."
leftIcon={<SvgIcon name="search" color="green" />}
rightIcon={<SvgIcon name="arrowdown" color="red" />}
/>
input-ios4.png

5. TextArea effect

<TextArea label="Name" placeholder="Please enter your name" />
input-ios5.png

6. TextArea with character limit

<TextArea label="Details" placeholder="Please enter details" limit={20} />
input-ios6.png

7. InputItem effect

<InputItem label="Name" placeholder="Please enter your name" />
input-ios7.png

8. InputItem sets extra attribute

<InputItem
label="Name"
placeholder="Please enter your name"
extra={<Text style={{ color: "green" }}>test</Text>}
/>
input-ios8.png

9. Password input box

<InputItem
label="password"
placeholder="Please enter password"
allowClear={false}
inputType="password"
required
colon
/>
input-ios9.png

API

Input attribute

Inherits the properties of the TextInput component, but removes the placeholderTextColor, onChange, and onChangeText properties.

See: https://reactnative.dev/docs/textinput

PropertiesRequiredDescriptionTypeDefault Value
labelfalselabelReactNode
labelPositionfalseLabel position. The left or top side of the input boxleft | topleft
inputTypefalseInput box type. Text input box or password input boxinput | passwordinput
inputStylefalseInput box custom styleTextStyleinput
leftIconfalseleft iconReactNode
rightIconfalseRight iconReactNode
allowClearfalseWhether to display the clear iconbooleantrue
valuefalseThe value of the input boxstring
onChangefalseCallback for input box value change(value: string) => void
disabledfalseWhether to disable the input boxbooleanfalse
colonfalseWhether to display colon after the labelbooleanfalse
requiredfalseWhether to display the required identifier before the labelbooleanfalse
onClearfalseClear content() => void
brieffalseOther contentReactNode

InputItem Properties

PropertiesRequiredDescriptionTypeDefault Value
labelfalselabelReactNode
inputTypefalseInput box type. Text input box or password input boxinput | passwordinput
inputStylefalseInput box custom styleTextStyleinput
extrafalseReactNode
allowClearfalseWhether to display the clear iconbooleantrue
valuefalseThe value of the input boxstring
onChangefalseCallback for input box value change(value: string) => void
colonfalseWhether to display colon after the labelbooleanfalse
requiredfalseWhether to display the required identifier before the labelbooleanfalse
onClearfalseCallback when the clear button is clicked() => void
borderfalseWhether to display the bottom borderbooleantrue
stylefalseContainer custom styleViewStyle
brieffalseOther contentReactNode

_When the onClear event is passed, onChange will no longer be automatically triggered, and the onClear event needs to be processed to clear the value. _

TextArea Properties

PropertiesRequiredDescriptionTypeDefault Value
labelfalselabelReactNode
valuefalseThe value of the input boxstring
onChangefalseCallback for input box value change(value: string) => void
heightfalseText field heightnumber150
limitfalseEnter the text length limit. Do not display if not passednumber
requiredfalseWhether to display the required identifier before the labelbooleanfalse
borderfalseWhether there is a borderbooleantrue
stylefalseContainer custom styleViewStyle
brieffalseOther contentReactNode