ShellUI Logo
ShellUI

Input

Text input field component with variant support and two-way binding.

The Input component provides a styled text input field with support for all standard HTML input types, two-way binding, and focus/blur events.

Installation

shellui add input

Usage

Basic

<Input Placeholder="Enter your name" />

Input Types

<Input Placeholder="email@example.com" Type="email" />
<Input Placeholder="Enter password" Type="password" />
<Input Placeholder="Enter amount" Type="number" />
<Input Placeholder="Search..." Type="search" />

With Label

<div class="space-y-2">
  <Label For="email">Email</Label>
  <Input Placeholder="email@example.com" Type="email" />
</div>

Two-way Binding

<Input @bind-Value="email" Placeholder="Enter email" Type="email" />

@code {
    private string email = "";
}

ValueChanged Callback

<Input Value="@email" ValueChanged="@HandleEmailChanged" Placeholder="Enter email" />

@code {
    private string email = "";

    private void HandleEmailChanged(string value)
    {
        email = value;
    }
}

Disabled and ReadOnly

<Input Placeholder="Disabled input" Disabled="true" />
<Input Value="Read-only value" ReadOnly="true" />

Custom Class

<div class="relative">
  <span class="absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground">@</span>
  <Input Class="pl-10" Placeholder="Email" Type="email" />
</div>

API Reference

ParameterTypeDefaultDescription
VariantInputVariantDefaultVisual style variant
Typestring"text"HTML input type attribute
Valuestring""Current input value
Placeholderstring""Placeholder text
DisabledboolfalseDisables the input
ReadOnlyboolfalseMakes input read-only
Classstring?nullAdditional CSS classes
ValueChangedEventCallback<string>Fires when value changes
OnFocusEventCallback<FocusEventArgs>Fires when input gains focus
OnBlurEventCallback<FocusEventArgs>Fires when input loses focus

Accessibility

  • Proper label association via For / Id attributes
  • ARIA attributes for validation states
  • Keyboard navigation support
  • Screen reader compatible

On this page