Email Input
Email input with automatic validation and keyboard optimization.
Featuresβ
- β Email validation
- β¨οΈ Email keyboard type
- π€ Lowercase auto-conversion
- π§ Auto-complete support
Basic Usageβ
import {Input} from '@tansuk/rott-ui'
<Input
name='email'
type='email'
placeholder='Enter your email'
value={email}
onChangeText={setEmail}
/>
With Labelβ
<Input
name='email'
type='email'
label='Email Address'
placeholder='[email protected]'
value={email}
onChangeText={setEmail}
/>
With Validationβ
<Input
name='email'
type='email'
label='Email'
value={email}
onChangeText={setEmail}
errorMessage={errors.email}
touched={touched.email}
/>
Propsβ
| Prop | Type | Description |
|---|---|---|
name | string | Required - Input identifier |
type | 'email' | Required - Must be 'email' |
value | string | Current value |
onChangeText | (text: string) => void | Change handler |
placeholder | string | Placeholder text |
label | string | InputLabelProps | Input label |
errorMessage | string | Error message |
touched | boolean | Validation touched state |
Keyboard Typeβ
Automatically sets:
keyboardType: 'email-address'autoCapitalize: 'none'autoComplete: 'email'autoCorrect: false
Validation Exampleβ
import {Formik} from 'formik'
import * as Yup from 'yup'
const EmailSchema = Yup.object().shape({
email: Yup.string().email('Invalid email').required('Required'),
})
<Formik
initialValues={{email: ''}}
validationSchema={EmailSchema}
onSubmit={handleSubmit}>
{({handleChange, values, errors, touched}) => (
<Input
name='email'
type='email'
label='Email'
value={values.email}
onChangeText={handleChange('email')}
errorMessage={touched.email ? errors.email : ''}
touched={touched.email}
/>
)}
</Formik>
Relatedβ
- Input - Main input documentation
- Password Input - Password input
- Forms Guide - Complete form examples