Input

Text input field for single-line user data entry

Setup

import { Input } from '@fragments-sdk/ui';

Examples

Default

Basic text input

Loading preview...

With Value

Input with pre-filled value

Loading preview...

With Helper

Input with helper text

Loading preview...

Error State

Input showing validation error

Loading preview...

Disabled

Non-interactive input

Loading preview...

Required

Required field with asterisk indicator

Loading preview...

Sizes

Available size variants

Loading preview...

Bare Input (Field Composition)

Disable the built-in wrapper for custom Field composition

Loading preview...

Shortcut Focus Hotkey

Display shortcut hint and opt into focus behavior

Loading preview...

Success State

Input showing validated/success styling

Loading preview...

With Start Adornment

Input with icon or prefix before the text

Loading preview...

With End Adornment

Input with icon or suffix after the text

Loading preview...

Props

PropTypeDefaultDescription
valuestringNot setCurrent input value (controlled)
defaultValuestringNot setDefault value for uncontrolled usage
placeholderstringNot setPlaceholder text shown when empty
typeenumnumbertextemailpasswordtelurltextHTML input type for validation and keyboard
sizeenumsmmdlgmdSize variant
disabledbooleanfalseWhether the input is interactive
errorbooleanfalseWhether to show error styling
successbooleanfalseWhether to show success/validated styling
labelstringNot setLabel text displayed above input
requiredbooleanfalseWhether the field is required (shows asterisk)
helperTextstringNot setHelper or error message below input
startAdornmentnodeNot setContent rendered before the input (icon or prefix text)
endAdornmentnodeNot setContent rendered after the input (icon or suffix text)
shortcutstringNot setKeyboard shortcut hint displayed inside the input
shortcutBehaviorenumdisplay-onlyfocus-inputdisplay-onlyWhether shortcut hint is visual only or also registers a global focus hotkey
onChangefunctionNot setCalled with new value on change
onValueChangefunctionNot setValue-first change callback alias: (value: string) => void
onBlurfunctionNot set
onFocusfunctionNot set
onKeyDownfunctionNot set
rootPropsobjectNot setHTML attributes applied to the wrapper element
inputStyleobjectNot setInline styles applied directly to the input element
inputClassNamestringNot setClass name applied directly to the input element
withFieldWrapperbooleantrueRender built-in label/helper wrapper (set false for Field composition or bare input rendering)
classNamestringNot setWrapper class name
styleobjectNot setWrapper styles

Usage Guidelines

When to use

  • Collecting single-line text data from users
  • Email, password, phone number, or URL input
  • Search fields
  • Short form fields (name, title, etc.)

When not to use

  • Multi-line text (use Textarea)
  • Selecting from predefined options (use Select)
  • Boolean input (use Checkbox or Switch)
  • Date/time input (use DatePicker)

Best practices

  • Always provide a label for accessibility
  • Use appropriate input type for data validation
  • Show validation errors with error prop and helperText
  • Use placeholder for format hints, not labels
  • Shortcut hints are display-only by default; set shortcutBehavior="focus-input" to opt into global hotkey focusing
Accessibility
  • Labels must be associated with inputs
  • Error messages should be announced to screen readers
  • Required fields should be indicated