Skip to main content

TextInput

Inputs & Controls

TextInput

Material text field with outlined and filled variants, leading/trailing adornments.

Usage

Capture short or long-form textual data with validation states.

Highlights

  • Floating label + helper integration
  • Supports secure entry and formatting hooks

When to use it

  • Forms require accessible labeling and error messaging.
  • Need to embed icons or buttons inside inputs.

Examples

Default

Preview (Web)
import { TextInput } from 'react-native-molecules/components/TextInput';

export default function Example() {
  return <TextInput placeholder="Placeholder" />;
}

Outlined Variant

Preview (Web)
import { TextInput } from 'react-native-molecules/components/TextInput';

export default function Example() {
  return <TextInput variant="outlined" placeholder="Placeholder" label="Label" />;
}

Flat Variant

Preview (Web)
import { TextInput } from 'react-native-molecules/components/TextInput';

export default function Example() {
  return <TextInput variant="flat" placeholder="Placeholder" label="Label" />;
}

With Left Element

Preview (Web)
import { Icon } from 'react-native-molecules/components/Icon';
import { TextInput } from 'react-native-molecules/components/TextInput';

export default function Example() {
  return (
      <TextInput 
          variant="flat" 
          placeholder="Placeholder" 
          label="Label" 
          left={({ color, forceFocus }) => (
              <Icon
                  name="magnify"
                  type="material-community"
                  size={24}
                  onPress={forceFocus}
                  color={color}
              />
          )} 
      />
  );
}

With Right Element

Preview (Web)
import { Icon } from 'react-native-molecules/components/Icon';
import { TextInput } from 'react-native-molecules/components/TextInput';

export default function Example() {
  return (
      <TextInput 
          variant="flat" 
          placeholder="Placeholder" 
          label="Label" 
          right={({ color, forceFocus }) => (
              <Icon
                  name="magnify"
                  type="material-community"
                  size={24}
                  onPress={forceFocus}
                  color={color}
              />
          )} 
      />
  );
}
PropTypeDefaultDescription
styleStyleProp<TextStyle>
testIDstring | undefined
numberOfLinesnumber | undefined
selectionColorstring | undefined
multilineboolean | undefined
onChangeText(((text: string) => void) & Function) | undefined
placeholderstring | undefined
valuestring | undefined
refReact.RefObject<TextInputHandles | null> | undefined
variantTextInputVariant | undefined
disabledboolean | undefined
labelTextInputLabelProp | undefined
errorboolean | undefined
underlineColorstring | undefined
activeUnderlineColorstring | undefined
outlineColorstring | undefined
activeOutlineColorstring | undefined
sizeTextInputSize | undefined
supportingTextstring | undefined
requiredboolean | undefined
render((props: RenderProps) => ReactNode) | undefined
inputContainerStyleStyleProp<ViewStyle>
inputStyleStyleProp<TextStyle>
rightElementStyleStyleProp<TextStyle>
leftElementStyleStyleProp<TextStyle>
stateLayerPropsViewProps | undefined
Defined in react-native-molecules/components/TextInput