Text Field

Text input component for single-line and multiline text entry with validation, adornments, character counting, and accessibility features. Built on FodInput with full support for various input types and internationalization.

Quick Start

Basic FodInput with Label, Placeholder, and HelperText for text entry.

Basic TextField

Required for your profile
Value: -

With Clearable

Click X to clear
Value: -

Immediate Mode

Value updates immediately
Value: -
razor
<FodInput T="string"
          Label="Full name"
          Placeholder="Enter your name"
          HelperText="Required for your profile"
          @bind-Value="_name" />

Input Types

FodInput supports various HTML input types for specialized text entry.

Text (default)

Email

Password

Search

Telephone

URL

razor
<FodInput T="string"
          Label="Email address"
          InputType="InputType.Email"
          Placeholder="name@example.com"
          AutoComplete="email"
          @bind-Value="_email" />

Validation

FodInput supports required fields, custom validation functions, and EditForm integration.

Required Field

Cannot be empty

Custom Validation

Enter 13-digit personal ID

Status Variants

This needs attention
Looking good!
razor
<FodInput T="string"
          Label="IDNP (13 digits)"
          Validation="@ValidateIdnp"
          @bind-Value="_idnp" />

@code {
    private string? ValidateIdnp(string? value) =>
        string.IsNullOrEmpty(value) ? "Required" :
        value.Length != 13 ? "Must be 13 digits" :
        !value.All(char.IsDigit) ? "Digits only" : null;
}

Adornments

Add visual elements before or after the input using StartAdornment and EndAdornment.

Currency prefix/suffix

$USD

With icon adornment

#

URL with protocol

https://
razor
<FodInput T="string" Label="Price" @bind-Value="_price">
    <StartAdornment>
        <span>$</span>
    </StartAdornment>
    <EndAdornment>
        <span>USD</span>
    </EndAdornment>
</FodInput>

Character Counter

Display character count with MaxLength to help users stay within limits.

Short bio (150 chars)

Keep it brief0/150
Characters: 0/150

Tweet (280 chars)

0/280
Remaining: 280

Username (20 chars)

Alphanumeric only0/20
razor
<FodInput T="string"
          Label="Bio"
          Counter="true"
          MaxLength="150"
          HelperText="Keep it brief"
          @bind-Value="_bio" />

Multiline (Textarea)

Enable multiline text entry with configurable rows, auto-grow, and maximum lines.

Fixed rows (3 lines)

Fixed 3-line height

Auto-grow (2-6 lines)

Expands up to 6 lines
Lines: 1

With counter

0/500
razor
<FodInput T="string"
          Label="Notes"
          Multiline="true"
          Lines="2"
          MaxLines="6"
          AutoGrow="true"
          @bind-Value="_notes" />

Password Features

Implement password visibility toggle and confirmation patterns.

Password with toggle

Confirm password

razor
<FodInput T="string"
          Label="Password"
          InputType="@(_showPassword ? InputType.Text : InputType.Password)"
          @bind-Value="_password">
    <EndAdornment>
        <button type="button" @onclick="() => _showPassword = !_showPassword">
            @(_showPassword ? "Hide" : "Show")
        </button>
    </EndAdornment>
</FodInput>

Disabled & Readonly

Non-interactive states for displaying information or preventing edits.

Disabled

This field is disabled

Readonly

Text can be selected and copied

Disabled with adornment

$
razor
<FodInput T="string"
          Label="Disabled field"
          Value="_disabledValue"
          Disabled="true" />

<FodInput T="string"
          Label="Readonly field"
          Value="_readonlyValue"
          ReadOnly="true" />

RTL & Internationalization

FodInput supports right-to-left languages with proper text alignment and adornment mirroring.

Arabic Locale (RTL)

#
مطلوب للملف الشخصي0/50
سيتم التحقق من صحة التنسيق

Hebrew (RTL)

0/120

RTL considerations:

  • Labels, placeholders, and helper text align to logical start (right in RTL)
  • Adornments mirror via padding-inline
  • Counter and validation messages maintain logical positioning
  • Caret and selection respect bidirectional text
razor
<div dir="rtl" lang="ar">
    <FodInput T="string"
              Label="الاسم الكامل"
              Placeholder="أدخل اسمك"
              @bind-Value="_rtlName" />
</div>

API Reference

FodInput string-type component properties and their descriptions.

No properties defined.

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please reload the page.