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
labelstringFloating label text.
placeholderstringPlaceholder shown inside the input when empty.
valuestringControlled input value.
defaultValuestringInitial value for uncontrolled usage.
namestringForm field name (for accessibility / form libraries).
idstringUnique identifier for the input element.
maxLengthnumberMaximum character length.
showCharacterCountbooleanDisplays a current/max character counter below the input.
isDisabledbooleanDisables the input field.
hasErrorbooleanApplies error border styling.
errorMessagestringError text displayed below the input when hasError is true.
inputModeInputModeKeyboard type. One of: 'text', 'search', 'tel', 'url', 'email', 'numeric', 'decimal', 'password', 'none'.
autoCompletestringMaps to React Native's autoComplete prop.
autoFocusbooleanAuto-focuses the input on mount.
returnKeyTypeReturnKeyTypeOptionsReturn key label (e.g. 'done', 'next', 'search').
multilinebooleanEnables multiline text entry.
numberOfLinesnumberVisible line count for multiline inputs.
onChange(value: string) => voidCalled on every keystroke with the current text value.
onBlur() => voidCalled when the input loses focus.
onFocus() => voidCalled when the input gains focus.
onSubmitEditing() => voidCalled when the return key is pressed.
scrollIntoViewbooleanScrolls the input into view on focus (requires scrollRef).
scrollRefReact.RefObject<ScrollView>Ref to the parent ScrollView used for scrollIntoView.
colorConfigNeoPopInputFieldColorConfigPer-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.