Input
Single-line text input with variant styling.
Installation
Add the Input component using the CLI:
shadcnblazor component add input
Usage
The Input component provides a single-line text input. Use Value and ValueChanged for two-way binding. Set Placeholder, Type, and Size as needed.
Examples
Sizes
Use the Size parameter for Sm, Md, or Lg inputs.
Form validation (aria-invalid)
Wrap your form in FormValidationProvider with Invalid and ErrorMessageId. Input and Button receive the context and apply aria-invalid and aria-errormessage automatically.
API Reference
Input
Single-line text input with variant styling.
Properties
| Name | Type | Description |
|---|---|---|
AdditionalAttributes |
Dictionary<string, Object> |
|
Class |
string |
|
Disabled |
bool |
Whether the input is disabled. |
OnChange |
EventCallback<ChangeEventArgs> |
Callback invoked when the input change event fires. |
Placeholder |
string |
Placeholder text when the value is empty. |
Size |
Size |
The size of the input. |
Type |
string |
The HTML input type (e.g., text, password, email). |
Value |
string |
The current value of the input. |
ValueChanged |
EventCallback<string> |
Callback invoked when the value changes. |
Events
| Name | Type | Description |
|---|---|---|
OnChange |
EventCallback<ChangeEventArgs> |
Callback invoked when the input change event fires. |
ValueChanged |
EventCallback<string> |
Callback invoked when the value changes. |
Methods
| Method | Returns | Description |
|---|---|---|
Equals |
bool |
|
GetHashCode |
int |
|
GetType |
Type |
|
SetParametersAsync |
Task |
|
ToString |
string |
Mobile support for API reference coming soon.