Blazor Toolkit TextBox Component
The TextBox component is an input element that allows users to enter, edit, and display text values. It provides various customization options including floating labels, clear button, multiline support, and input validation.
Add the TextBox component in the application as shown in the below code example.
Variants
The TextBox component offers two visual variants: Filled, and Outlined
Disabled
When the Disabled property is set to true, the TextBox component cannot be edited or focused.
Read-Only
When the ReadOnly property is set to true, the TextBox component cannot be edited.
Icons
The TextBox component allows for icon integration, with the ability to place icons at the start or end of the input using the AddIconAsync method.
Customization
Use CSS to customize the TextBox component's appearance. To prevent hierarchy conflicts, add extra class names. Here are some customization examples.
Adaptive Rendering
The TextBox component implements context-sensitive rendering behavior through its Type property.
Color
The TextBox component offers validation styles by adding e-success, e-warning and e-error classes to the CssClass property.
Float Label
The floating label functionality offers three distinct behavioral modes: Never, Auto, and Always.
Clear Button
When the ShowClearButton property is set to true, the TextBox component displays the clear button while typing.
Multiline Text Area
The TextBox component offers a multiline mode to create a textarea for capturing longer text content such as comments, descriptions, or addresses by setting the Multiline property as true.
Form Support
The TextBox component integrates seamlessly with the form, as shown below.
Registration Form
Events
The TextBox component supports the OnInput, ValueChange, OnFocus, and OnBlur events.
Event:
Accessibility
The Blazor TextBox follows accessibility guidelines and standards commonly used to evaluate UI accessibility, including ADA, Section 508, WCAG 2.2, and WAI‑ARIA.
The accessibility compliance for the Blazor TextBox component is outlined below.
| Accessibility Criteria | Compatibility |
|---|---|
| WCAG 2.2 Support | ![]() |
| Section 508 Support | ![]() |
| Screen Reader Support | ![]() |
| Right-To-Left Support | ![]() |
| Color Contrast | ![]() |
| Mobile Device Support | ![]() |
| Keyboard Navigation Support | ![]() |
- All features of the component meet the requirement.
- Some features of the component do not meet the requirement.
- The component does not meet the requirement.WAI-ARIA Attributes
The Blazor TextBox is characterized with complete ARIA Accessibility support that helps to access through the on-screen readers and other assistive technology devices. This component is designed with the reference of the guidelines document given in WAI ARAI Accessibility practices.
The TextBox uses the textbox role and following ARIA properties for its element based on its state.
| Property | Functionality |
|---|---|
aria-placeholder |
The aria-placeholder is a short hint to help the users with data entry when the TextBox has no value. |
aria-labelledby |
The aria-labelledby property indicates the floating label element of the TextBox. |