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
valuestring—Current input value
onChangeText(text: string) => void—Called when text changes
typeInputType'text'Input type: text, email, password, number, tel, url, search
sizeInputSize'md'Size preset: sm, md, lg
roundedInputRadius—Border radius: none, sm, md, lg, full
placeholderstring—Placeholder text
labelstring—Visible label above input
helpTextstring—Help text below input
errorTextstring—Error message (replaces helpText)
disabledbooleanfalseDisabled state
readonlybooleanfalseReadonly state
requiredbooleanfalseRequired field (visual indicator)
blockbooleanfalseFull-width input
maxLengthnumber—Maximum character length
accessibilityLabelstring—Accessibility label (falls back to label)
onFocus() => void—Called on focus
onBlur() => void—Called 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.