Prepared Docs

Prepared Docs

⌘K

    Loading navigation…

User

  1. Components
  2. Input
  3. API and Development

Input

API and Development

View Source
Submit Issue

Input is used to capture text-based user input with support for labels, validation, icons, affixes, masking, and integrated select controls. It provides a comprehensive text input solution with two main components: Input for standard text entry and InputWithSelect for inputs paired with dropdown selections. Built on Radix UI's TextField component, both ensure consistent form patterns across the interface with extensive customization options including labels, helper text, icons, prefixes, suffixes, input masking, and validation states.

Input Props

NameDefaultDescription
labelLabel text displayed above the input field.
labelColorEnum for label color variants. Other variations of LabelColor include Base | Error.
placeholderPlaceholder text displayed when the input is empty.
helperTextHelper text displayed below the input field.
helperTextColorEnum for helper text color variants. Other variations of TextColor include Base | Alt | Alt2 | Error | Success.
leadIconThe SVG asset for an icon displayed before the input field.
tailIconThe SVG asset for an icon displayed after the input field.
prefixText or React node displayed before (to the left of) the input field with a bordered container.
suffixText or React node displayed after (to the right of) the input field with a bordered container.
type"text"Standard HTML input type. Supported types include text | number | email | password | tel | url | search | date | time.
maskedfalseWhether to apply input masking. Automatically enabled for tel and url types.
maskTypeEnum for mask pattern. Variations of MaskType include Phone | Url | ZipCode | Currency | Date.
onRawChangeCallback providing both raw (unmasked) and formatted values: (rawValue: string, formattedValue: string) => void.
disabledfalseWhether the input is disabled.
requiredfalseWhether the input is required for form submission.
readOnlyfalseWhether the input is read-only.
valueControlled value of the input.
defaultValueDefault value for uncontrolled usage.
onChangeCallback fired when the input value changes.
onFocusCallback fired when the input receives focus.
onBlurCallback fired when the input loses focus.
onKeyDownCallback fired when a key is pressed.
idUnique identifier for the input field.
nameName attribute for form submission.
autoFocusfalseWhether to automatically focus the input on mount.
autoCompleteBrowser autocomplete behavior hint.
maxLengthMaximum number of characters allowed.
minLengthMinimum number of characters required.
patternRegular expression pattern for validation.
aria-invalidIndicates whether the input value is invalid.
aria-requiredIndicates whether the input is required.
aria-describedbyID of element describing the input.
aria-errormessageID of element containing error message (use only when aria-invalid is true).

InputWithSelect Props

Inherits all Input props plus:

NameDefaultDescription
selectControlPositionrequiredEnum for select position. Values include Lead | Tail.
selectOptionsrequiredArray of options with value and label properties.
selectedValueCurrently selected value in the dropdown.
onSelectChangeCallback fired when the select value changes: (value: string) => void.
selectWidthSelectControlWidth.MediumEnum for select width. Values include Small | Medium | Large.
selectDisabledfalseWhether the select dropdown is disabled.
selectPlaceholderPlaceholder text for the select dropdown.

Basic Text Input

Use for standard text entry with label and placeholder.

Controlled vs Uncontrolled

Controlled Input

Use when you need full control over the input state.

Uncontrolled Input

Use when you don't need to control the state directly.

With value (static)

Icons

Required and helper text

Error state

Disabled

Prefix and suffix

Masks

With Affixes

Use prefixes and suffixes to display static text or symbols adjacent to the input.

Prefix

Suffix

Both Affixes

With Helper Text

With Helper Text

Use to provide additional context or instructions for the input.

With Icons

With Icons

Use icons to provide visual context about the input's purpose or state.

Lead Icon

Tail Icon

Both Icons

With Input Masking

With Input Masking

Use masking to format input values automatically for common patterns.

Phone Number

Currency

ZIP Code

Date

URL

With Raw Value Callback

With Raw Value Callback

Use when you need both the formatted display value and the raw unmasked value.

Validation States

Use to communicate input validation status to users.

Error State

Success State

Disabled State

Use when the input should not be editable.

Read-Only State

Use when the value should be visible but not editable.

Required Input

Use to indicate that a field must be completed.

With Auto-Focus

Use to automatically focus the input when the component mounts.

Input With Select (Lead Position)

Use when you need a dropdown selection before the input field.

Input With Select (Tail Position)

Use when you need a dropdown selection after the input field.

Phone Input With Country Code

Use for international phone number entry with country code selection.

Input With Select and Affixes

Combine select controls with prefix or suffix text.

Disabled Input With Select

Use when the combined input and select should not be editable.

Form Integration

Use inputs within forms with proper labeling and validation.

Previous

Input / Usage

Next

Accessibility / Labels and Identification

On this page

Input Props
InputWithSelect Props
Basic Text Input
Controlled vs Uncontrolled
Controlled Input
Uncontrolled Input
With value (static)
Icons
Required and helper text
Error state
Disabled
Prefix and suffix
Masks
With Affixes
Prefix
Suffix
Both Affixes
With Helper Text
With Icons
Lead Icon
Tail Icon
Both Icons
With Input Masking
Phone Number
Currency
ZIP Code
Date
URL
With Raw Value Callback
With Raw Value Callback
Validation States
Error State
Success State
Disabled State
Read-Only State
Required Input
With Auto-Focus
Input With Select (Lead Position)
Input With Select (Tail Position)
Phone Input With Country Code
Input With Select and Affixes
Disabled Input With Select
Form Integration