Skip to main content

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

PropTypeDescription
namestringRequired - Input identifier
type'email'Required - Must be 'email'
valuestringCurrent value
onChangeText(text: string) => voidChange handler
placeholderstringPlaceholder text
labelstring | InputLabelPropsInput label
errorMessagestringError message
touchedbooleanValidation 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>