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 TextInput. 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.
Replacing Component:
- Form: React Native View
- Item: React Native TouchableOpacity
- Input: React Native TextInput
- Label: React Native Text
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, Header, Content, Form, Item, Input } from 'native-base';
export default class FormExample extends Component {
render() {
return (
<Container>
<Header />
<Content>
<Form>
<Item>
<Input placeholder="Username" />
</Item>
<Item last>
<Input placeholder="Password" />
</Item>
</Form>
</Content>
</Container>
);
}
}Configuration
| Property | Default | Option | Description |
|---|---|---|---|
| fixedLabel | true | boolean | Label is Fixed to the left of the Input and does not hide when text is entered. |
| floatingLabel | true | boolean | Label that animates upwards when the input is selected and animates downward when input is erased. |
| inlineLabel | - | boolean | 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 underline border with the textbox. |
| disabled | - | - | Disables inputting data. |
| placeholderLabel | - | - | Renders the same way the TextInput does with the form styling of NativeBase. |
| placeholder | - | - | The string that will be rendered before text input has been entered. Optional user-defined placeholder for textbox. |
| last | - | - | Style the Form Item for the last Item of the Form. |
| error | - | - | The border color of textbox for invalid input. |
| success | - | - | The border color of textbox for valid input. |
**Note:** Form in NativeBase is just a wrapper around the inputs and hence has no onSubmit function.

