NativeBase makes use of List to design Forms that include group of related input components. Include any combination of NativeBase components to make up your form.
Input is a NativeBase component built on top of React Native's . Item component is wrap around it apply the specific styles.
A foundational component for inputting text into the app via a keyboard. Props provide configurability for several features, such as auto-correction, auto-capitalization, placeholder text, and different keyboard types, such as a numeric keypad. Provides a number of attributes that follows styling and interaction guidelines for each platform, so that they are intuitive for users to interact with.
Note: Form in native base is just a wrapper around the inputs and hence has no onSubmit function.
Contents:
- Fixed Label
- Inline Label
- Floating Label
- Stacked Label
- Regular Textbox
- Underlined Textbox
- Rounded Textbox
- Icon Textbox
- Success Input Textbox
- Error Input Textbox
- Disabled Textbox
Syntax
import React, { Component } from 'react';
import { Container, Content, Form, Item, Input } from 'native-base';
export default class FormExample extends Component {
render() {
return (
<Container>
<Content>
<Form>
<Item>
<Input placeholder="Username" />
</Item>
<Item last>
<Input placeholder="Password" />
</Item>
</Form>
</Content>
</Container>
);
}
}Configuration
| Property | Default | Option | Description |
|---|---|---|---|
| fixedLabel | - | - | Label is Fixed to the left of the Input and does not hide when text is entered. |
| floatingLabel | - | - | Label that animates upwards when the input is selected and animates downward when input is erased. |
| inlineLabel | - | - | Label placed to the left of the input element. When the user enters text, the label does not hide. This can also be used along with placeholder. |
| stackedLabel | - | - | Places the label on top of the input element which appears like a stack. This can also be used along with placeholder. |
| bordered | - | - | Includes border with the textbox. |
| rounded | - | - | Includes rounded border with the textbox. |
| underline | true | - | Includes and underline border with the textbox. |
| disabled | - | - | Disables inputting data. |
| error | - | - | The border color of textbox for invalid input. |
| placeholder | - | - | The string that will be rendered before text input has been entered. Optional user-defined placeholder for textbox. |
| secureTextEntry | false | true false | If true, the text input obscures the text entered so that sensitive text like passwords stay secure. This prop can be passed to Input. |
| success | - | - | The border color of textbox for valid input. |
| last | - | - | Style the Form Item for the last Item of the Form. |

