Skip to main content

NeoPopInputField

A NeoPop-styled text input with floating label, focus/error border states, character count, and multiline support.

Usage​

// dark mode example
import { NeoPopInputField } from 'neopop-rn';
import { useState } from 'react';

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

return (
<NeoPopInputField
label="Mobile number"
placeholder="Enter 10-digit number"
value={value}
inputMode="tel"
maxLength={10}
showCharacterCount
colorMode="dark"
onChange={setValue}
/>
);
}
// light mode example
import { NeoPopInputField } from 'neopop-rn';
import { useState } from 'react';

function Example() {
const [value, setValue] = useState('');
const [error, setError] = useState(false);

return (
<NeoPopInputField
label="Email"
placeholder="you@example.com"
value={value}
inputMode="email"
hasError={error}
errorMessage="Invalid email address"
colorMode="light"
colorConfig={{
containerBorderColor: '#cccccc',
focusedBorderColor: '#0d0d0d',
errorBorderColor: '#EE4D37',
labelColor: '#555555',
inputTextColor: '#0d0d0d',
placeholderColor: '#999999',
backgroundColor: '#ffffff',
}}
onChange={setValue}
/>
);
}

Props​

PropTypeDefaultDescription
labelstring—Floating label text.
placeholderstring—Placeholder shown inside the input when empty.
valuestring—Controlled input value.
defaultValuestring—Initial value for uncontrolled usage.
namestring—Form field name (for accessibility / form libraries).
idstring—Unique identifier for the input element.
maxLengthnumber—Maximum character length.
showCharacterCountboolean—Displays a current/max character counter below the input.
isDisabledboolean—Disables the input field.
hasErrorboolean—Applies error border styling.
errorMessagestring—Error text displayed below the input when hasError is true.
inputModeInputMode—Keyboard type. One of: 'text', 'search', 'tel', 'url', 'email', 'numeric', 'decimal', 'password', 'none'.
autoCompletestring—Maps to React Native's autoComplete prop.
autoFocusboolean—Auto-focuses the input on mount.
returnKeyTypeReturnKeyTypeOptions—Return key label (e.g. 'done', 'next', 'search').
multilineboolean—Enables multiline text entry.
numberOfLinesnumber—Visible line count for multiline inputs.
onChange(value: string) => void—Called on every keystroke with the current text value.
onBlur() => void—Called when the input loses focus.
onFocus() => void—Called when the input gains focus.
onSubmitEditing() => void—Called when the return key is pressed.
scrollIntoViewboolean—Scrolls the input into view on focus (requires scrollRef).
scrollRefReact.RefObject<ScrollView>—Ref to the parent ScrollView used for scrollIntoView.
colorConfigNeoPopInputFieldColorConfig—Per-token color overrides (see colorConfig table).
colorMode'dark' | 'light'—Theme mode for default colors.
styleStyleProp<ViewStyle>—Additional style for the outer container.
inputStyleStyleProp<TextStyle>—Additional style for the TextInput element.
labelStyleStyleProp<TextStyle>—Additional style for the label text.

colorConfig​

KeyDescription
containerBorderColorDefault border color of the input container.
focusedBorderColorBorder color when the input is focused.
errorBorderColorBorder color when hasError is true.
labelColorColor of the floating label.
inputTextColorColor of the typed text.
placeholderColorPlaceholder text color.
backgroundColorBackground fill of the input container.
disabledBackgroundColorBackground color when isDisabled is true.

Notes​

  • showCharacterCount requires maxLength to be set; without it, the counter shows currentLength / undefined.
  • inputMode: 'password' sets secureTextEntry automatically; do not use multiline with password mode.
  • scrollIntoView only works when a valid scrollRef pointing to a ScrollView ancestor is provided.