Skip to main content

Input

Input

Built on top of React Native's TextInput component, this basic component which allows the user to enter text was styled based on Galio's own identity theme.

Input

Usage

Imports:

import { Input, Block } from 'galio-framework';

Basic examples:

<Input placeholder="regular" />
<Input placeholder="theme" color={theme.COLORS.THEME} style={{ borderColor: theme.COLORS.THEME }} placeholderTextColor={theme.COLORS.THEME} />
<Input placeholder="info" color={theme.COLORS.INFO} style={{ borderColor: theme.COLORS.INFO }} placeholderTextColor={theme.COLORS.INFO}/>
<Input placeholder="warning" color={theme.COLORS.WARNING} style={{ borderColor: theme.COLORS.WARNING }} placeholderTextColor={theme.COLORS.WARNING}/>
<Input placeholder="error" color={theme.COLORS.ERROR} style={{ borderColor: theme.COLORS.ERROR }} placeholderTextColor={theme.COLORS.ERROR}/>
<Input placeholder="success" color={theme.COLORS.SUCCESS} style={{ borderColor: theme.COLORS.SUCCESS }} placeholderTextColor={theme.COLORS.SUCCESS}/>

Advanced examples:

<Input placeholder="password" password viewPass />
<Input placeholder="rounded input" rounded />
<Input
placeholder="Input with Icon on right"
right
icon="heart"
iconFamily="antdesign"
iconSize={14}
iconColor="red"
/>
<Input
placeholder="Input with custom styling and help"
style={{ borderColor: "red" }}
help="Bottom help text"
bottomHelp
placeholderTextColor="#4F8EC9"
/>

Modern usage with hooks:

const [value, setValue] = useState('');

<Input
value={value}
onChangeText={setValue}
placeholder="Controlled input"
color="primary"
rounded
shadowless
/>

Props

PropTypeDefaultDescription
valuestringnullThe input value (controlled component)
onChangeTextfunctionnullCallback when text changes
typestring'default'Keyboard type. Options: 'default', 'number-pad', 'decimal-pad', 'numeric', 'email-address', 'phone-pad'
passwordboolfalsePassword input with secure text entry
placeholderTextColorstringtheme.COLORS.PLACEHOLDERPlaceholder text color
labelstringnullInput label
bgColorstringnullBackground color
roundedboolfalseRounded corners
borderlessboolfalseRemoves border
viewPassboolfalsePassword visibility toggle
iconstringnullIcon name from Expo's icon library
iconColorstringnullIcon color
iconFamilystringnullIcon family from Expo's icon library
iconSizenumber14Icon size
colorstringnullText color
helpstringnullHelper text
leftbooltrueIcon on the left
rightboolfalseIcon on the right
topHelpbooltrueHelper above input
bottomHelpboolfalseHelper below input
styleobjectnullCustom styles
inputStyleobjectnullCustom input styles
labelStyleobjectnullCustom label styles
helpStyleobjectnullCustom help text styles
...TextInput.props--All TextInput props are supported