Skip to content

Input (React Native)

Text input component with label, help text, error state, and theme-driven styling via useGrundtoneTheme().


Installation

tsx
import { GTInput } from '@grundtone/react-native';

Usage

Basic

tsx
<GTInput value={name} onChangeText={setName} placeholder="Enter your name" />

With label and help text

tsx
<GTInput
  value={email}
  onChangeText={setEmail}
  type="email"
  label="Email"
  placeholder="john@example.com"
  helpText="We'll never share your email."
  required
/>

Error state

tsx
<GTInput
  value={username}
  onChangeText={setUsername}
  label="Username"
  errorText="Username is already taken"
/>

Props

PropTypeDefaultDescription
valuestringCurrent input value
onChangeText(text: string) => voidCalled when text changes
typeInputType'text'Input type: text, email, password, number, tel, url, search
sizeInputSize'md'Size preset: sm, md, lg
roundedInputRadiusBorder radius: none, sm, md, lg, full
placeholderstringPlaceholder text
labelstringVisible label above input
helpTextstringHelp text below input
errorTextstringError message (replaces helpText)
disabledbooleanfalseDisabled state
readonlybooleanfalseReadonly state
requiredbooleanfalseRequired field (visual indicator)
blockbooleanfalseFull-width input
maxLengthnumberMaximum character length
accessibilityLabelstringAccessibility label (falls back to label)
onFocus() => voidCalled on focus
onBlur() => voidCalled on blur

Sizes

Sizes match GTButton for consistent form alignment:

SizeFontPadding (v / h)
smfont-size-smspace-xs / space-sm
mdfont-size-basespace-sm / space-md
lgfont-size-lgspace-md / space-xl

Type Mapping

The type prop maps to React Native's keyboardType and secureTextEntry:

TypekeyboardTypesecureTextEntry
textdefaultfalse
emailemail-addressfalse
passworddefaulttrue
numbernumericfalse
telphone-padfalse
urlurlfalse
searchdefaultfalse

Theming

All colors, spacing, typography, and radii come from useGrundtoneTheme(). The component responds to light/dark mode automatically.

Focus state shows a primary-colored border. Error state shows an error-colored border.