Accent color
TextField
TextInput
Text fields give people a way to enter and edit text. They’re used in forms, modal dialogs, tables, and other surfaces where text input is required.
Usage
Basics
<BitTextField Label="Basic" />
<BitTextField Label="Placeholder" Placeholder="Enter a text..." />
<BitTextField Label="Disabled" IsEnabled="false" />
<BitTextField Label="ReadOnly" ReadOnly DefaultValue="This is ReadOnly" />
<BitTextField Label="Description" Description="This is Description" />
<BitTextField Label="Required" Required />
<BitTextField Label="MaxLength: 5" MaxLength="5" />
<BitTextField Label="Auto focused" AutoFocus />Displays various basic configurations for the BitTextField, including placeholders, disabled state, read-only mode, descriptions, and required fields.
Underlined
<BitTextField Label="Basic" Underlined />
<BitTextField Label="Placeholder" Underlined Placeholder="Enter a text..." />
<BitTextField Label="Disabled" Underlined IsEnabled="false" />
<BitTextField Label="Required" Underlined Required />Showcases the BitTextField with an underlined style, including variations with placeholders, disabled state, and required fields.
No border
<BitTextField Label="Basic" Placeholder="Enter a text..." NoBorder />
<BitTextField Label="Disabled" Placeholder="Enter a text..." NoBorder IsEnabled="false" />
<BitTextField Label="Required" Placeholder="Enter a text..." NoBorder Required />Demonstrates BitTextField without borders, including variations for disabled and required fields.
Multiline
<BitTextField Label="Multiline" Multiline />
<BitTextField Label="Resizable" Multiline Resizable />
<BitTextField Label="Rows = 10" Multiline Rows="10" />
<BitTextField Label="AutoHeight" Multiline AutoHeight />
<BitTextField Label="PreventEnter (use Shift+Enter for new-line)" Multiline AutoHeight PreventEnter />Displays BitTextField in multiline mode with options for resizable and fixed sizes, as well as setting the number of rows.
Icon
<BitTextField Label="Email" IconName="@BitIconName.EditMail" />
<BitTextField Label="Calendar" IconName="@BitIconName.Calendar" />Shows how to add icons to the BitTextField component, including examples with different icon names.
Prefix & Suffix
<BitTextField Label="Prefix" Prefix="https://" />
<BitTextField Label="Suffix" Suffix=".com" />
<BitTextField Label="Prefix and Suffix" Prefix="https://" Suffix=".com" />
<BitTextField Label="Disabled" Prefix="https://" Suffix=".com" IsEnabled="false" />Use prefixes and suffixes in BitTextField, including combinations and the disabled state.
https://
.com
https://
.com
https://
.com
Templates
<BitTextField>
<LabelTemplate>
<BitLabel Style="color:coral">Custom Label</BitLabel>
</LabelTemplate>
</BitTextField>
<BitTextField Label="Custom Description">
<DescriptionTemplate>
<BitLabel Style="color:coral">Description</BitLabel>
</DescriptionTemplate>
</BitTextField>
<BitTextField Label="Custom Prefix">
<PrefixTemplate>
<BitLabel Style="color:coral;margin:0 5px">Prefix</BitLabel>
</PrefixTemplate>
</BitTextField>
<BitTextField Label="Custom Suffix">
<SuffixTemplate>
<BitLabel Style="color:coral;margin:0 5px">Suffix</BitLabel>
</SuffixTemplate>
</BitTextField>Demonstrates the use of custom templates for labels, descriptions, prefixes, and suffixes in BitTextField.
Password
<BitTextField Label="Password" Type="BitInputType.Password" />
<BitTextField Label="Reveal Password" Type="BitInputType.Password" CanRevealPassword />Shows BitTextField configured for password entry, including an option to reveal the password.
ShowClearButton
<BitTextField Label="Email" DefaultValue="[email protected]" ShowClearButton />Displays BitTextField with a clear button that appears when the field has a value.
Binding
<BitTextField Label="One-way" Value="@oneWayValue" /> <div>Value: [@oneWayValue]</div> <BitOtpInput Length="5" Style="margin-top: 5px;" @bind-Value="oneWayValue" /> <BitTextField Label="Two-way" @bind-Value="twoWayValue" /> <div>Value: [@twoWayValue]</div> <BitOtpInput Length="5" Style="margin-top: 5px;" @bind-Value="twoWayValue" Immediate /> <BitTextField Label="OnChange" OnChange="(v) => onChangeValue = v" Immediate /> <BitLabel>Value: [@onChangeValue]</BitLabel> <BitTextField Label="Immediate" @bind-Value="@immediateValue" Immediate /> <div>Value: [@immediateValue]</div> <BitTextField Label="Debounce" @bind-Value="@debounceValue" Immediate DebounceTime="300" /> <div>Value: [@debounceValue]</div> <BitTextField Label="Throttle" @bind-Value="@throttleValue" Immediate ThrottleTime="300" /> <div>Value: [@throttleValue]</div>@code { private string oneWayValue; private string twoWayValue; private string onChangeValue; private string? immediateValue; private string? debounceValue; private string? throttleValue; }
Demonstrates various binding scenarios with BitTextField, including one-way, two-way, on-change events, and immediate, debounce, and throttle options.
Value: []
Value: []
Value: []
Value: []
Value: []
GhostText
<BitTextField @bind-Value="ghostBasicTextValue" Immediate Label="Basic Single-line" GhostText="@ghostBasicSuggestion" Placeholder="Type 'app', 'ban', 'car', or 'dog'..." OnGhostTextAccepted="(_ => ghostBasicSuggestion = null)" OnChange="(v => ghostBasicSuggestion = GetGhostSuggestion(v))" /> <div>Value: [@ghostBasicTextValue]</div> <BitTextField @bind-Value="ghostBasicMultilineValue" Multiline Resizable Rows="5" Immediate PermanentGhost Label="Basic Multiline" GhostText="@ghostBasicMultilineSuggestion" Placeholder="Type 'app', 'ban', 'car', or 'dog'..." OnGhostTextAccepted="(_ => ghostBasicMultilineSuggestion = null)" OnChange="(v => ghostBasicMultilineSuggestion = GetGhostSuggestion(v))" /> <div>Value: [@ghostBasicMultilineValue]</div> <BitTextField @bind-Value="ghostTextValue" Immediate Label="Single-line" GhostText="@ghostSuggestion" Placeholder="Type 'app', 'ban', 'car', or 'dog'..." OnGhostTextAccepted="(_ => ClearGhostSuggestion(isMultiline: false))" OnChange="(v => SetGhostSuggestionAsync(v, isMultiline: false))" /> <div>Value: [@ghostTextValue]</div> <BitTextField @bind-Value="ghostMultilineValue" Multiline Resizable Rows="5" Immediate PermanentGhost Label="Multiline" GhostText="@ghostMultilineSuggestion" Placeholder="Type 'app', 'ban', 'car', or 'dog'..." OnGhostTextAccepted="(_ => ClearGhostSuggestion(isMultiline: true))" OnChange="(v => SetGhostSuggestionAsync(v, isMultiline: true))" /> <div>Value: [@ghostMultilineValue]</div>@code { private string? ghostBasicTextValue; private string? ghostBasicSuggestion; private string? ghostBasicMultilineValue; private string? ghostBasicMultilineSuggestion; private string? ghostTextValue; private string? ghostSuggestion; private string? ghostMultilineValue; private string? ghostMultilineSuggestion; private CancellationTokenSource? _ghostSuggestionCts; private CancellationTokenSource? _ghostMultilineSuggestionCts; private static readonly string[] _suggestions = [ "application form", "banana smoothie", "car repair manual", "dog training guide" ]; private static string? GetGhostSuggestion(string? value) { if (string.IsNullOrEmpty(value)) return null; if (char.IsWhiteSpace(value[^1])) return null; var lastWord = value.Split((char[]?)null, StringSplitOptions.RemoveEmptyEntries).LastOrDefault(); if (string.IsNullOrEmpty(lastWord)) return null; var match = _suggestions.FirstOrDefault(s => s.StartsWith(lastWord, StringComparison.OrdinalIgnoreCase)); return match?[lastWord.Length..]; } private async Task SetGhostSuggestionAsync(string? value, bool isMultiline) { var cts = new CancellationTokenSource(); if (isMultiline) { CancelAndDispose(ref _ghostMultilineSuggestionCts); _ghostMultilineSuggestionCts = cts; ghostMultilineSuggestion = null; } else { CancelAndDispose(ref _ghostSuggestionCts); _ghostSuggestionCts = cts; ghostSuggestion = null; } try { var suggestion = await GetGhostSuggestionAsync(value, cts.Token); if (cts.IsCancellationRequested) return; if (isMultiline) { ghostMultilineSuggestion = suggestion; } else { ghostSuggestion = suggestion; } } catch (OperationCanceledException) { } } private void ClearGhostSuggestion(bool isMultiline) { if (isMultiline) { CancelAndDispose(ref _ghostMultilineSuggestionCts); ghostMultilineSuggestion = null; } else { CancelAndDispose(ref _ghostSuggestionCts); ghostSuggestion = null; } } private static void CancelAndDispose(ref CancellationTokenSource? cts) { cts?.Cancel(); cts?.Dispose(); cts = null; } private static async Task<string?> GetGhostSuggestionAsync(string? value, CancellationToken cancellationToken) { await Task.Delay(300, cancellationToken); return GetGhostSuggestion(value); } }
Demonstrates the ghost text (inline suggestion) feature. Set the GhostText parameter to show a faded inline suggestion after the cursor position. Press Tab, Enter, or click/touch to accept it and append it to the current value.
Basic (non-async)
Value: []
Value: []
Advanced (async + cancellation)
Value: []
Value: []
Trim
<BitTextField Label="Trimmed" Trim @bind-Value="trimmedValue" /> <pre>[@trimmedValue]</pre> <BitTextField Label="Not Trimmed" @bind-Value="notTrimmedValue" /> <pre>[@notTrimmedValue]</pre>@code { private string trimmedValue; private string notTrimmedValue; }
Demonstrates various binding scenarios with BitTextField, including one-way, two-way, on-change events, and immediate, debounce, and throttle options.
[]
[]
Validation
<style> .validation-message { color: red; } </style> <EditForm Model="validationTextFieldModel" OnValidSubmit="HandleValidSubmit" OnInvalidSubmit="HandleInvalidSubmit" novalidate> <DataAnnotationsValidator /> <BitTextField Label="Required" Required @bind-Value="validationTextFieldModel.Text" /> <ValidationMessage For="() => validationTextFieldModel.Text" /> <BitTextField Label="Numeric" @bind-Value="validationTextFieldModel.NumericText" /> <ValidationMessage For="() => validationTextFieldModel.NumericText" /> <BitTextField Label="Only chars" @bind-Value="validationTextFieldModel.CharacterText" /> <ValidationMessage For="() => validationTextFieldModel.CharacterText" /> <BitTextField Label="Email" @bind-Value="validationTextFieldModel.EmailText" /> <ValidationMessage For="() => validationTextFieldModel.EmailText" /> <BitTextField Label="3 < Length < 5" @bind-Value="validationTextFieldModel.RangeText" /> <ValidationMessage For="() => validationTextFieldModel.RangeText" /> <BitButton ButtonType="BitButtonType.Submit">Submit</BitButton> </EditForm>@code { public class ValidationTextFieldModel { [Required(ErrorMessage = "This field is required.")] public string Text { get; set; } [RegularExpression("0*[1-9][0-9]*", ErrorMessage = "Only numeric values are allowed.")] public string NumericText { get; set; } [RegularExpression("^[a-zA-Z0-9.]*$", ErrorMessage = "Only letters(a-z), numbers(0-9), and period(.) are allowed.")] public string CharacterText { get; set; } [EmailAddress(ErrorMessage = "Invalid e-mail address.")] public string EmailText { get; set; } [StringLength(5, MinimumLength = 3, ErrorMessage = "The text length must be between 3 and 5 chars.")] public string RangeText { get; set; } } private ValidationTextFieldModel validationTextFieldModel = new(); private void HandleValidSubmit() { } private void HandleInvalidSubmit() { } }
Demonstrates how validation can be applied to BitTextField, including required fields, numeric input, character constraints, email validation, and range validation.
Background
<BitTextField Label="Primary" Background="BitColorKind.Primary" IconName="@BitIconName.Calendar" />
<BitTextField Label="Secondary" Background="BitColorKind.Secondary" IconName="@BitIconName.Calendar" />
<BitTextField Label="Tertiary" Background="BitColorKind.Tertiary" IconName="@BitIconName.Calendar" />
<BitTextField Label="Transparent" Background="BitColorKind.Transparent" IconName="@BitIconName.Calendar" />Providing a range of color kinds for the background of the text field.
Border
<BitTextField Label="Primary" Border="BitColorKind.Primary" />
<BitTextField Label="Secondary" Border="BitColorKind.Secondary" />
<BitTextField Label="Tertiary" Border="BitColorKind.Tertiary" />
<BitTextField Label="Transparent" Border="BitColorKind.Transparent" />Providing a range of color kinds for the border of the text field.
Accent
<BitTextField Label="Primary" Accent="BitColor.Primary" IconName="@BitIconName.Calendar" />
<BitTextField Label="Secondary" Accent="BitColor.Secondary" IconName="@BitIconName.Calendar" />
<BitTextField Label="Tertiary" Accent="BitColor.Tertiary" IconName="@BitIconName.Calendar" />
<BitTextField Label="Info" Accent="BitColor.Info" IconName="@BitIconName.Calendar" />
<BitTextField Label="Success" Accent="BitColor.Success" IconName="@BitIconName.Calendar" />
<BitTextField Label="Warning" Accent="BitColor.Warning" IconName="@BitIconName.Calendar" />
<BitTextField Label="SevereWarning" Accent="BitColor.SevereWarning" IconName="@BitIconName.Calendar" />
<BitTextField Label="Error" Accent="BitColor.Error" IconName="@BitIconName.Calendar" />
<BitTextField Label="PrimaryBackground" Accent="BitColor.PrimaryBackground" IconName="@BitIconName.Calendar" />
<BitTextField Label="SecondaryBackground" Accent="BitColor.SecondaryBackground" IconName="@BitIconName.Calendar" />
<BitTextField Label="TertiaryBackground" Accent="BitColor.TertiaryBackground" IconName="@BitIconName.Calendar" />
<BitTextField Label="PrimaryForeground" Accent="BitColor.PrimaryForeground" IconName="@BitIconName.Calendar" />
<BitTextField Label="SecondaryForeground" Accent="BitColor.SecondaryForeground" IconName="@BitIconName.Calendar" />
<BitTextField Label="TertiaryForeground" Accent="BitColor.TertiaryForeground" IconName="@BitIconName.Calendar" />
<BitTextField Label="PrimaryBorder" Accent="BitColor.PrimaryBorder" IconName="@BitIconName.Calendar" />
<BitTextField Label="SecondaryBorder" Accent="BitColor.SecondaryBorder" IconName="@BitIconName.Calendar" />
<BitTextField Label="TertiaryBorder" Accent="BitColor.TertiaryBorder" IconName="@BitIconName.Calendar" />Offering a range of specialized color variants with Primary being the default, providing visual cues for specific actions or states within your application.
External Icons
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/7.0.1/css/all.min.css" />
<BitTextField Label="House" Icon="@("fa-solid fa-house")" />
<BitTextField Label="Heart" Icon="@BitIconInfo.Css("fa-solid fa-heart")" />
<BitTextField Label="GitHub" Icon="@BitIconInfo.Fa("brands github")" />
<BitTextField Label="Rocket" Icon="@BitIconInfo.Fa("solid rocket")" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.min.css" />
<BitTextField Label="House" Icon="@("bi bi-house-fill")" />
<BitTextField Label="Heart" Icon="@BitIconInfo.Css("bi bi-heart-fill")" />
<BitTextField Label="GitHub" Icon="@BitIconInfo.Bi("github")" />
<BitTextField Label="Gear" Icon="@BitIconInfo.Bi("gear-fill")" />Use icons from external libraries like FontAwesome, Material Icons, and Bootstrap Icons with the Icon parameter.
FontAwesome:
Bootstrap:
Style & Class
<style> .custom-class { overflow: hidden; margin-inline: 1rem; border-radius: 1rem; border: 2px solid brown; } .custom-class *, .custom-class *::after { border: none; } .custom-class::after { content: ''; width: 0; left: 50%; bottom: 0; height: 2px; position: absolute; background-color: red; transition: width 0.3s ease, left 0.3s ease; } .custom-class:focus::after { left: 0; width: 100%; } .custom-root { height: 3rem; display: flex; align-items: end; position: relative; margin-inline: 1rem; } .custom-label { top: 0; left: 0; z-index: 1; padding: 0; font-size: 1rem; color: darkgray; position: absolute; transform-origin: top left; transform: translate(0, 22px) scale(1); transition: color 200ms cubic-bezier(0, 0, 0.2, 1) 0ms, transform 200ms cubic-bezier(0, 0, 0.2, 1) 0ms; } .custom-label-top { transform: translate(0, 1.5px) scale(0.75); } .custom-input { padding: 0; font-size: 1rem; font-weight: 900; } .custom-field { border-radius: 0; position: relative; border-width: 0 0 1px 0; } .custom-field::after { content: ''; width: 0; height: 2px; border: none; position: absolute; inset: 100% 0 0 50%; background-color: blueviolet; transition: width 0.3s ease, left 0.3s ease; } .custom-focus .custom-field::after { left: 0; width: 100%; } .custom-focus .custom-label { color: blueviolet; transform: translate(0, 1.5px) scale(0.75); } </style> <BitTextField Style="box-shadow: aqua 0 0 1rem; margin-inline: 1rem;" /> <BitTextField Class="custom-class" /> <BitTextField Label="Styles" Styles="@(new() { Root = "margin-inline: 1rem;", Focused = "--focused-background: #b2b2b25a;", FieldGroup = "background: var(--focused-background);", Label = "text-shadow: aqua 0 0 1rem; font-weight: 900; font-size: 1.25rem;", Input = "padding: 0.5rem;" })" /> <BitTextField @bind-Value="classesValue" Label="Classes" Classes="@(new() { Root = "custom-root", FieldGroup = "custom-field", Focused = "custom-focus", Input = "custom-input", Label = $"custom-label{(string.IsNullOrEmpty(classesValue) ? string.Empty : " custom-label-top")}" })" />@code { private string? classesValue; }
Explores styling and class customization for BitTextField, including component styles, custom classes, and detailed style options.
Component's Style & Class:
Styles & Classes:
RTL
<BitTextField Dir="BitDir.Rtl"
Placeholder="پست الکترونیکی"
IconName="@BitIconName.EditMail" />
<BitTextField Underlined
Label="تقویم"
Dir="BitDir.Rtl"
IconName="@BitIconName.Calendar" />Use BitTextField in right-to-left (RTL).
API
BitTextField parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| Accent | BitColor? | null | The general color of the text field used when focused. |
| AutoHeight | bool | false | Automatically adjust the height of the input in Multiline mode. |
| Background | BitColorKind? | null | The color kind of the text field background. |
| Border | BitColorKind? | null | The color kind of the text field border. |
| CanRevealPassword | bool | false | Whether to show the reveal password button for input type 'password'. |
| Classes | BitTextFieldClassStyles? | null | Custom CSS classes for different parts of the BitTextField. |
| ClearButtonIcon | BitIconInfo? | null | The icon to display inside the clear button. Takes precedence over ClearButtonIconName when both are set. |
| ClearButtonIconName | string? | Cancel | Gets or sets the name of the icon to display on the clear button from the built-in Fluent UI icons. |
| Description | string? | null | Description displayed below the text field to provide additional details about what text to enter. |
| DescriptionTemplate | RenderFragment? | null | Shows the custom description for text field. |
| FullWidth | bool | false | Forces the text field fill 100% of its container width. |
| GhostText | string? | null | The ghost/suggestion text displayed inline after the current cursor position. Update this value from outside (e.g. from an AI or autocomplete suggestion) to show a faded inline suggestion. The user can accept it by pressing Tab or Enter, or clicking/touching the ghost text. |
| HidePasswordIcon | BitIconInfo? | null | Gets or sets the icon for the reveal password button when password is shown using custom CSS classes for external icon libraries. |
| HidePasswordIconName | string? | null | The icon name for the reveal password button when password is shown from the built-in Fluent UI icons. |
| Icon | BitIconInfo? | null | Gets or sets the icon to display using custom CSS classes for external icon libraries. Takes precedence over IconName when both are set. |
| IconName | string? | null | The icon name for the icon shown in the far right end of the text field from the built-in Fluent UI icons. |
| InputMode | BitInputMode? | null | Sets the inputmode html attribute of the input element. |
| Label | string? | null | Label displayed above the text field and read by screen readers. |
| LabelTemplate | RenderFragment? | null | Shows the custom label for text field. |
| MaxLength | int | -1 | Specifies the maximum number of characters allowed in the input. |
| Multiline | bool | false | Whether or not the text field is a Multiline text field. |
| NoBorder | bool | false | Removes the border of the text input. |
| OnClear | EventCallback | Callback executed when the user clears the text field by clicking the clear button. | |
| OnClick | EventCallback<MouseEventArgs> | Callback for when the input clicked. | |
| OnEnter | EventCallback<KeyboardEventArgs> | Callback for when the Enter key is pressed while input has focus. | |
| OnFocus | EventCallback<FocusEventArgs> | Callback for when focus moves into the input. | |
| OnFocusIn | EventCallback<FocusEventArgs> | Callback for when focus moves into the input. | |
| OnFocusOut | EventCallback<FocusEventArgs> | Callback for when focus moves out of the input. | |
| OnGhostTextAccepted | EventCallback<string?> | Callback invoked when the ghost text is accepted via Tab or Enter key, or click/touch. The accepted ghost text string is passed as the argument. | |
| OnKeyDown | EventCallback<KeyboardEventArgs> | Callback for when a keyboard key is pressed. | |
| OnKeyUp | EventCallback<KeyboardEventArgs> | Callback for When a keyboard key is released. | |
| PermanentGhost | bool | false | Enables permanent ghost mode that forces the scrollbar-gutter to always be present, preventing layout shift of the ghost text rendering. |
| Placeholder | string? | null | Input placeholder text. |
| Prefix | string? | null | Prefix displayed before the text field contents. This is not included in the value. Ensure a descriptive label is present to assist screen readers, as the value does not include the prefix. |
| PrefixTemplate | RenderFragment? | null | Shows the custom prefix for text field. |
| PreventEnter | bool | false | Prevents the enter to add new line character into the input in the Multiline mode. |
| Resizable | bool | false | For multiline text fields, whether or not the field is resizable. |
| RevealPasswordAriaLabel | string? | null | Aria label for the reveal password button. |
| RevealPasswordIcon | BitIconInfo? | null | Gets or sets the icon for the reveal password button when password is hidden using custom CSS classes for external icon libraries. |
| RevealPasswordIconName | string? | null | The icon name for the reveal password button when password is hidden from the built-in Fluent UI icons. |
| Rows | int? | null | For multiline text, Number of rows. |
| ShowClearButton | bool | false | Whether to show the clear button when the text field has a value. |
| Styles | BitTextFieldClassStyles? | null | Custom CSS styles for different parts of the BitTextField. |
| Suffix | string? | null | Suffix displayed after the text field contents. This is not included in the value. Ensure a descriptive label is present to assist screen readers, as the value does not include the suffix. |
| SuffixTemplate | RenderFragment? | null | Shows the custom suffix for text field. |
| Trim | bool | false | Specifies whether to remove any leading or trailing whitespace from the value. |
| Type | BitInputType? | null | Input type. |
| Underlined | bool | false | Whether or not the text field is underlined. |
BitTextField public members
| Name | Type | Default value | Description |
|---|---|---|---|
| InputElement | ElementReference | The ElementReference to the input element of the BitTextField. | |
| FocusAsync | ValueTask | Gives focus to the input element of the BitTextField. |
BitTextInputBase parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| AutoComplete | string? | null | Specifies the value of the autocomplete attribute of the input component. |
| AutoFocus | bool | false | Determines if the text input is auto focused on first render. |
| DebounceTime | int | 0 | The debounce time in milliseconds. |
| Immediate | bool | false | Change the content of the input field when the user write text (based on 'oninput' HTML event). |
| ThrottleTime | int | 0 | The throttle time in milliseconds. |
BitInputBase parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| DefaultValue | TValue? | null | The default value of the input to be used in uncontrolled mode (i.e. when the Value is not bound), typically used alongside the OnChange callback. |
| DisplayName | string? | null | Gets or sets the display name for this field. |
| InputHtmlAttributes | IReadOnlyDictionary<string, object>? | null | Gets or sets a collection of additional attributes that will be applied to the created element. |
| Name | string? | null | Gets or sets the name of the element. Allows access by name from the associated form. |
| NoValidate | bool | false | Disables the validation of the input. |
| OnChange | EventCallback<TValue?> | Callback for when the input value changes. | |
| ReadOnly | bool | false | Makes the input read-only. |
| Required | bool | false | Makes the input required. |
| Value | TValue? | null | Gets or sets the value of the input. This should be used with two-way binding. |
BitInputBase public members
| Name | Type | Default value | Description |
|---|---|---|---|
| InputElement | ElementReference | The ElementReference of the input element. | |
| FocusAsync() | () => ValueTask | Gives focus to the input element. | |
| FocusAsync(bool preventScroll) | (bool preventScroll) => ValueTask | Gives focus to the input element. |
BitComponentBase parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| AriaLabel | string? | null | Gets or sets the accessible label for the component, used by assistive technologies. |
| Class | string? | null | Gets or sets the CSS class name(s) to apply to the rendered element. |
| Dir | BitDir? | null | Gets or sets the text directionality for the component's content. |
| ForceAnimation | bool | false | Gets or sets a value indicating whether the component's animations play at their full duration even when reduced motion is requested. |
| HtmlAttributes | Dictionary<string, object> | new Dictionary<string, object>() | Captures additional HTML attributes to be applied to the rendered element, in addition to the component's parameters. |
| Id | string? | null | Gets or sets the unique identifier for the component's root element. |
| IsEnabled | bool | true | Gets or sets a value indicating whether the component is enabled and can respond to user interaction. |
| Style | string? | null | Gets or sets the CSS style string to apply to the rendered element. |
| TabIndex | string? | null | Gets or sets the tab order index for the component when navigating with the keyboard. |
| Visibility | BitVisibility | BitVisibility.Visible | Gets or sets the visibility state (visible, hidden, or collapsed) of the component. |
BitComponentBase public members
| Name | Type | Default value | Description |
|---|---|---|---|
| UniqueId | Guid | Guid.NewGuid() | Gets the readonly unique identifier for the component's root element, assigned when the component instance is constructed. |
| RootElement | ElementReference | Gets the reference to the root HTML element associated with this component. |
BitTextFieldClassStyles properties
| Name | Type | Default value | Description |
|---|---|---|---|
| Root | string? | null | Custom CSS classes/styles for the BitTextField's root element. |
| Focused | string? | null | Custom CSS classes/styles of the root element in focus state. |
| InputWrapper | string? | null | Custom CSS classes/styles for the wrapper of label and input in the BitTextField. |
| Label | string? | null | Custom CSS classes/styles for the BitTextField's label. |
| FieldGroup | string? | null | Custom CSS classes/styles for the BitTextField's field group. |
| PrefixContainer | string? | null | Custom CSS classes/styles for the BitTextField's prefix container. |
| Prefix | string? | null | Custom CSS classes/styles for the BitTextField's prefix. |
| Input | string? | null | Custom CSS classes/styles for the BitTextField's input. |
| RevealPassword | string? | null | Custom CSS classes/styles for the BitTextField's reveal password. |
| RevealPasswordIconContainer | string? | null | Custom CSS classes/styles for the BitTextField's reveal password icon container. |
| RevealPasswordIcon | string? | null | Custom CSS classes/styles for the BitTextField's reveal password icon. |
| ClearButton | string? | null | Custom CSS classes/styles for the BitTextField's clear button. |
| ClearButtonIcon | string? | null | Custom CSS classes/styles for the BitTextField's clear button icon. |
| Icon | string? | null | Custom CSS classes/styles for the BitTextField's icon. |
| SuffixContainer | string? | null | Custom CSS classes/styles for the BitTextField's suffix container. |
| Suffix | string? | null | Custom CSS classes/styles for the BitTextField's suffix. |
| DescriptionContainer | string? | null | Custom CSS classes/styles for the BitTextField's description container. |
| Description | string? | null | Custom CSS classes/styles for the BitTextField's description. |
| GhostTextWrapper | string? | null | Custom CSS classes/styles for the BitTextField's ghost text wrapper element. |
| GhostTextOverlay | string? | null | Custom CSS classes/styles for the BitTextField's ghost text overlay container. |
BitIconInfo properties
| Name | Type | Default value | Description |
|---|---|---|---|
| Name | string? | null | Gets or sets the name of the icon. |
| BaseClass | string? | null | Gets or sets the base CSS class for the icon. For built-in Fluent UI icons, this defaults to "bit-icon". For external icon libraries like FontAwesome, you might set this to "fa" or leave empty. |
| Prefix | string? | null | Gets or sets the CSS class prefix used before the icon name. For built-in Fluent UI icons, this defaults to "bit-icon--". For external icon libraries, you might set this to "fa-" or leave empty. |
BitColor enum
| Name | Value | Description |
|---|---|---|
| Primary | 0 | Info Primary general color. |
| Secondary | 1 | Secondary general color. |
| Tertiary | 2 | Tertiary general color. |
| Info | 3 | Info general color. |
| Success | 4 | Success general color. |
| Warning | 5 | Warning general color. |
| SevereWarning | 6 | SevereWarning general color. |
| Error | 7 | Error general color. |
| PrimaryBackground | 8 | Primary background color. |
| SecondaryBackground | 9 | Secondary background color. |
| TertiaryBackground | 10 | Tertiary background color. |
| PrimaryForeground | 11 | Primary foreground color. |
| SecondaryForeground | 12 | Secondary foreground color. |
| TertiaryForeground | 13 | Tertiary foreground color. |
| PrimaryBorder | 14 | Primary border color. |
| SecondaryBorder | 15 | Secondary border color. |
| TertiaryBorder | 16 | Tertiary border color. |
BitColorKind enum
| Name | Value | Description |
|---|---|---|
| Primary | 0 | The primary color kind. |
| Secondary | 1 | The secondary color kind. |
| Tertiary | 2 | The tertiary color kind. |
| Transparent | 3 | The transparent color kind. |
BitInputType enum
| Name | Value | Description |
|---|---|---|
| Text | 0 | The input expects text characters. |
| Password | 1 | The input expects password characters. |
| Number | 2 | The input expects number characters. |
| 3 | The input expects email characters. | |
| Tel | 4 | The input expects tel characters. |
| Url | 5 | The input expects url characters. |
BitInputMode enum
| Name | Value | Description |
|---|---|---|
| None | 0 | The input expects text characters. |
| Text | 1 | Standard input keyboard for the user's current locale. |
| Decimal | 2 | Fractional numeric input keyboard containing the digits and decimal separator for the user's locale. |
| Numeric | 3 | Numeric input keyboard, but only requires the digits 0–9. |
| Tel | 4 | A telephone keypad input, including the digits 0–9, the asterisk (*), and the pound (#) key |
| Search | 5 | A virtual keyboard optimized for search input. |
| 6 | A virtual keyboard optimized for entering email addresses. | |
| Url | 7 | A keypad optimized for entering URLs. |
BitVisibility enum
| Name | Value | Description |
|---|---|---|
| Visible | 0 | The content of the component is visible. |
| Hidden | 1 | The content of the component is hidden, but the space it takes on the page remains (visibility:hidden). |
| Collapsed | 2 | The component is hidden (display:none). |
BitDir enum
| Name | Value | Description |
|---|---|---|
| Ltr | 0 | Ltr (left to right) is to be used for languages that are written from the left to the right (like English). |
| Rtl | 1 | Rtl (right to left) is to be used for languages that are written from the right to the left (like Arabic). |
| Auto | 2 | Auto lets the user agent decide. It uses a basic algorithm as it parses the characters inside the element until it finds a character with a strong directionality, then applies that directionality to the whole element. |
Feedback
You can give us your feedback through our GitHub repo by filing a new Issue or starting a new Discussion.
Or you can review / edit this page on GitHub.