UI Launch Docs

TextInput

TextInput component from the UILaunch design system. A customizable input field with support for labels, adornments, error handling, and helper texts.

🧩 TextInput Component

A customizable input field component based on react-native, styled using @shopify/restyle. It supports labels, variants, adornments, error handling, and helper texts.

Default state

TextInput Component

Disabled and Error states

TextInput Disabled and Error States

Usage

import Box from '@madefordevs1999/ui-launch-native/system/atoms/Box';
import TextInput, { InputVariantEnum } from '@madefordevs1999/ui-launch-native/system/atoms/TextInput';
import EditFilled from '@madefordevs1999/ui-launch-native/system/icons/informative/EditFilled/EditFilled';
import useTheme from '@madefordevs1999/ui-launch-native/system/theme/useTheme';

const Example: React.FC = () => {
  const {colors} = useTheme();

  return (
    <Box flex={1} justifyContent="center" alignItems="center">
      <TextInput
        label="Email"
        labelPosition="outside"
        placeholder="Enter your email"
        helperText="Please enter a valid email address"
        startAdornment={({ hasError }) => (
          <EditFilled
            color={hasError ? colors.TextError : colors.TextNeutral}
            size={SpacingValues.Spacing2}
          />
        )}
        inputVariant={InputVariantEnum.Outlined}
      />
    </Box>
  )
};

export default Example;

Results

TextInput Example

🎨 Styling Support (via Restyle)

The TextInput component supports styling through the Restyle system, allowing you to customize its appearance using theme tokens. So you can pass additional styling props thanks to the TextInputRestyleProps, such as:

  • padding, margin, borderColor, borderWidth
  • backgroundColor, fontSize, fontFamily
  • Any variant from your custom Restyle theme

InputVariantEnum

enum InputVariantEnum {
  Outlined = 'outlined',
  Underlined = 'underlined',
}

LabelPositionEnum

enum LabelPositionEnum {
  Inside = 'inside',
  Outside = 'outside',
}

📜 TextInput Props

Prop NameTypeDefaultDescription
disabledbooleanfalseIf true, the switch cannot be interacted with.
valuebooleanCurrent value of the switch (controlled).
initialValuebooleanfalseInitial value for the switch if value is not provided.
onValueChange(value: boolean) => voidCallback function when the switch is toggled.
activeTextstringText to display when the switch is active (checked).
inactiveTextstringText to display when the switch is inactive (unchecked).