Skip to content

Inputs

TextField

Bit.BlazorUITextInput

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. A single BitTextField renders either an input or a textarea, carries a label in any of the four positions around it, a visible or screen-reader-only description, a character counter and a message saying why the value was rejected, exposes every part of its chrome to templates and to the Styles and Classes parameters, wires its own labels and descriptions to the input through the aria attributes, and plugs into an EditForm the same way the built-in Blazor inputs do.

Usage

Every example is live. Open its code to see exactly what produced the component running underneath.

Basics

The everyday configurations of a text field. Label renders the caption above the input and is what a screen reader announces, so it is preferred over relying on Placeholder alone: a placeholder disappears the moment the first character is typed. Description adds a permanent hint under the field and is wired to the input through aria-describedby. IsEnabled="false" takes the field out of the tab order entirely, while ReadOnly keeps it focusable and copyable but refuses edits. Required renders the html required attribute and marks the label with an asterisk, MaxLength and MinLength map to the html length constraints, AutoFocus puts the caret in the field on the first render, and FullWidth makes the field fill the width of its container instead of sizing to its content.





This is Description



The browser rejects a shorter value on submit.


Underlined

The underlined variant drops the box around the field and keeps only the bottom rule, which is the denser look used in toolbars and inline editing. The label moves next to the input instead of above it, and the focus indicator becomes a thicker underline. Everything else - placeholder, disabled and required rendering - behaves exactly as in the default variant.




No border

NoBorder removes the frame around the field so it blends into the surface behind it, which is what a text field embedded in a card, a table cell or a custom composite control usually wants. The field keeps its focus ring, so keyboard users can still tell where they are.



Multiline

Multiline renders a textarea instead of an input. Rows sets its height, Resizable gives back the native resize grip that is hidden by default, and AutoHeight grows the field with its content so no scrollbar ever shows up. The two work together: Rows stays the floor of that growth, so a field asking for four rows does not collapse to a single line the moment its value is emptied. MaxRows puts a ceiling on it: past that many rows the field stops growing and scrolls internally, which is what keeps a long paste from pushing the rest of the page off screen. The height is measured again whenever the field itself changes width - a narrowed window, a panel folding away - since the same text takes a different number of lines once it re-wraps. PreventEnter stops the Enter key from inserting a new line - handy when Enter should submit the surrounding form - while Shift+Enter still adds one. Wrap passes through to the html attribute of the same name: off turns the wrapping off entirely and scrolls long lines sideways, which is what a field holding code or log lines wants, and hard makes the breaks the wrapping adds travel with the submitted value.








Input type

Type maps to the html type of the input, which decides what the browser does with the value: the password type masks it, the number type accepts floating-point syntax - digits, a decimal separator, a sign and the scientific notation - and reports anything else as invalid instead of refusing every non-digit character, the email and url types validate the format on submit, and the search type lets the browser offer the previous searches of the same field. InputMode is independent of it and only decides which virtual keyboard a phone brings up, so a text field asking for a PIN can still show the numeric keypad. EnterKeyHint relabels the return key of that keyboard, and Pattern, SpellCheck, AutoCorrect and AutoCapitalize pass through to the matching html attributes. The number type here is only the html one - the value is still bound as a string and there is no bound, no step and no spinner: a field that really holds a number wants BitNumberField, which binds any .NET numeric type and brings the clamping, the stepping and the spinbutton keyboard set with it.







A text input that opens the numeric keypad on a phone.

Relabels the return key of the on-screen keyboard.

The browser rejects anything but 3 letters on submit.

What a coupon code or a username field wants.

Icon

IconName renders an icon of the built-in Fluent UI set at the trailing end of the field. It is decorative by default - hidden from screen readers and not focusable - so it should reinforce the label rather than replace it; an icon that does carry a meaning of its own gets a name of its own through IconAriaLabel, shown in the Accessibility section. The icon picks up the Accent color while the field has focus, and goes grey along with the rest of the field while it is disabled.


Prefix & Suffix

A prefix and a suffix are static pieces of text rendered inside the frame of the field, before and after the input. They are not part of the value: a field with the https:// prefix still binds only what was typed. Because of that, keep a descriptive label on the field, since a screen reader reads the value without the affixes around it.

https://

.com

https://
.com

https://
.com

Templates

Every piece of chrome around the input can be replaced by a template when the plain string parameters are not enough: LabelTemplate, DescriptionTemplate, PrefixTemplate and SuffixTemplate take over from Label, Description, Prefix and Suffix, ClearButtonTemplate replaces the icon of the clear button, RevealPasswordTemplate receives whether the password is currently revealed, CountTemplate receives the current number of characters, ErrorMessageTemplate replaces the rejection message under the field and marks it invalid just like the plain ErrorMessage does, and LoadingTemplate replaces the spinner of the busy indicator (shown in the Loading section). A field rendered through a LabelTemplate still gets the required asterisk, so custom chrome never costs the field its markings.








0 of 20 characters

✖ This name is reserved. See the Validation section.

Password

Type="BitInputType.Password" masks the value. Adding CanRevealPassword renders a toggle button that swaps the input to plain text, which is the pattern that lets people check what they typed instead of typing the password twice. The button keeps one stable RevealPasswordAriaLabel in both states and reports the current state through aria-pressed, which is what screen readers announce reliably; the caret is handed back to the input after every toggle. RevealPasswordIconName and HidePasswordIconName customize the two icons, and the native reveal affordance that Edge and Internet Explorer add to a password input is taken away so that only one of them is ever shown. The ToggleRevealPassword method drives the same toggle from the outside - from a checkbox next to the form, for instance - and is ignored unless the field is a revealable password, so a revealed value can never survive the reveal being taken away. Pair the field with an AutoComplete of current-password or new-password: it is what tells a password manager whether to offer the saved credentials or to generate a new one, and it is the difference between a sign-in form that fills itself and one that fights the browser.



AutoComplete tells the browser which credential belongs here.


Clear button

ShowClearButton renders a button that empties the field, and it only appears while there is something to clear - from the very first keystroke, since it follows what the input holds rather than the bound value, which on a field without Immediate is only committed on blur. Clearing sets the value to null through the normal binding, fires OnClear and returns the focus to the input so typing can continue right away. The button is a real button with an ClearButtonAriaLabel, so it is reachable by keyboard, and it is disabled in the read-only and disabled states. ClearButtonIconName swaps its icon, and it works in the multiline mode too. A search input draws a clear affordance of its own in WebKit browsers, which is hidden while the clear button is on so that the field never shows two of them. The ClearAsync method does the same thing from code - without needing the button to be visible at all - and raises OnClear just like a click on it does.






Value: [Clear me from the button below]

Character count

ShowCount renders a counter under the field. With a MaxLength it reads typed/limit and is pointed at by aria-describedby, so a screen reader announces the limit along with the field; without one it is just the number of characters typed so far. The counter follows the keystrokes directly rather than the bound value, so it stays live even when Immediate is off and the value is only committed on blur. CountTemplate replaces the whole text with content of its own, shown in the Templates section. A count above the limit turns red: the keyboard cannot get there, since MaxLength renders the html maxlength attribute, but a value assigned from the code can, and a counter reading a number above its own limit in the muted grey of a valid one would say nothing about it.

By default the characters are counted the way the browser counts them against the limit - in UTF-16 code units - which makes an emoji count as two and a family emoji as eleven. CountStrategy replaces that with a count of your own, most often StringInfo.LengthInTextElements, which counts what a reader actually sees. It only changes the number that is shown: the maxlength attribute keeps holding the keyboard back at its own count, so a strategy that counts fewer characters than the browser does reaches the limit before the counter says so.

0/30

0

Both the description and the counter share the footer.
0/30

42/10

0/140
Value: []

7/20

The same value, counted the way it reads.
4/20

Binding

The value is committed on the change event by default, which for a text field means when it loses focus. Immediate switches to the input event so every keystroke updates the bound value; on top of it, DebounceTime waits until the typing pauses for that many milliseconds before committing, and ThrottleTime commits at most once per that many milliseconds - both of them are what a search-as-you-type field wants so it does not fire a request per character. DefaultValue seeds an uncontrolled field that reports through OnChange instead of a two-way binding. An Immediate field also guards against the input method editors used for Chinese, Japanese and Korean: the half-composed characters a candidate window produces are kept out of the bound value, which only receives the text once the composition is committed.

Value: []

Value: []


Value: []

Value: []

Value: []

Value: []

GhostText

Ghost text is the faded completion an editor shows after what has been typed. Set GhostText from the outside - from an autocomplete list, from a model, from anywhere - and it is painted behind the input without ever entering the value. Pressing Tab or Enter with the caret at the end of the text, or clicking/touching the field there, accepts it: the text is inserted, the bound value is updated whether or not Immediate is on, and OnGhostTextAccepted fires with the accepted string so the suggestion can be cleared or replaced. Any other keystroke discards the suggestion, and a suggestion that would not fit under MaxLength is cut down to whatever room is left rather than pushing the value past the limit the keyboard cannot pass either. PermanentGhost reserves the scrollbar gutter of a multiline field so the text does not shift when the suggestion makes it overflow. The overlay itself is painted for the eye only and hidden from screen readers, so the suggestion is announced through a polite live region instead - without it an inline completion would be a feature only sighted users ever learn about.

Basic (non-async)
Value: []

Value: []


Advanced (async + cancellation)
Value: []

Value: []

Trim

Trim strips the leading and trailing whitespace off the value, which is what keeps a stray space from being saved along with an email address or a coupon code. It is applied when the input reports a change - not on every keystroke - so a space can still be typed in the middle of a word while Immediate is on. Note that it does not touch a DefaultValue, which is assigned to the value as it is given.


[]




[]

Events

Besides OnChange, the field forwards the raw dom events it sits on: OnKeyDown and OnKeyUp for every key, OnEnter and OnEscape as shortcuts for the two keys a form cares about most, OnClick, and OnFocus, OnBlur, OnFocusIn and OnFocusOut for the focus lifecycle. The difference between the two pairs is bubbling: focus and blur are raised by the input alone, while focusin and focusout also reach it from whatever is inside it, which is what makes them the ones to watch when a whole group of controls is being tracked. All of them are skipped while the field is disabled. OnEnter and OnEscape are also skipped while an input method editor is composing, where the two keys commit and cancel a candidate rather than the value - so a form is never submitted in the middle of typing a Chinese or Japanese word.

OnInput is the one that fires on every input event, whichever way the text arrived - a keystroke, a paste, a drop, an autofill - which is what a strength meter or a live preview needs. Unlike OnChange it does not wait for the field to lose focus and it does not require Immediate, so it can watch the text without committing it, and it is raised before DebounceTime and ThrottleTime hold the value back rather than along with it. Like the rest of the events it stays quiet while an input method editor is composing, so it never sees a half-composed word.


Last event: []
Last key down: []
Last key up: []
Focus: []

Typed so far: []
Committed value: []

OnClear: []

Selection

SelectOnFocus selects the whole value the moment the field receives focus, so the next keystroke replaces it instead of appending to it - what a field holding a value meant to be overwritten rather than edited (a search term, a quantity, a generated code) usually wants. It applies to a read-only field too, where selecting the value is exactly what makes it easy to copy, and to an AutoFocus field, whose focus is given to it before anything could listen for it. The same thing is available from code through SelectAsync, and SelectRangeAsync selects only a part of the value, or moves the caret when the two positions are equal. Both positions are clamped to the length of the value, a null start counts from the beginning and a null end runs to the very end, so a range can never fall outside the text.




Label position

LabelPosition moves the label around the input: Top is the classic form layout, Bottom puts the caption under the field, and Start and End lay the two out on one line, which is what a compact settings row or a filter bar wants. The two row layouts follow the reading direction rather than the screen, so they mirror themselves in a right-to-left page. Leaving the parameter unset keeps the layout each variant comes with - above the input in the default one and next to it in the underlined one - so an existing field never moves on its own.





The footer keeps its own line under the whole row.
0/20

Loading

Loading shows a busy indicator inside the field, which is how a field says that something is running against what was typed - a suggestion being fetched, a name being checked for availability, a value being validated on the server. The field stays fully editable while it is on, so the typing is never interrupted. The input carries aria-busy while it is on, which is what tells an assistive technology that what it is reading is still being worked on, and a polite live region that is always part of the field announces that it started - politely, so it waits for the reader to finish the sentence it is on rather than cutting into it. LoadingAriaLabel is what that announcement says instead of the default "Loading", and LoadingTemplate replaces the spinner with any content - one of the other loading components of the library, an icon, a piece of text - without costing the field its announcement.

Loading

Loading

Loading
Checking the availability

Accessibility

A field is only usable by everyone when what it expects is exposed to assistive technologies as well as to the eye. Label is the first tool for that and should be preferred over AriaLabel, which names the input for a screen reader without showing anything - use it only where the surrounding layout already makes the purpose obvious. Setting both is allowed and the AriaLabel wins: the visible caption keeps labelling the field for the eye and for the click that focuses it, while the screen reader is given the fuller name. Description is the visible hint under the field, while AriaDescription is a hidden one for the cases where the instruction would be too long to show; both are referenced by the input through aria-describedby, in reading order, alongside the error message that comes first when there is one and the character counter when it carries a limit. An aria-describedby of your own, passed through InputHtmlAttributes, is kept and read first rather than replaced, which is what lets a field point at an error message the app renders next to it and still keep its own description. Title renders the html title of the field, which the browser shows as a tooltip on hover. The trailing icon is decorative and hidden from screen readers by default; IconAriaLabel turns it into an image with a name for the cases where the icon carries a meaning of its own.

Card number
Use the number printed on the back of your card, without the spaces between the groups.





Card number
The field also points at this element, which is not a part of it.

Validation

Inside an EditForm the field joins the cascading EditContext automatically, so the data annotations on the model drive it: a failing field gets the bit-inv class and the aria-invalid="true" attribute, and the state is refreshed on every validation pass. Use NoValidate to opt a field out of the EditContext altogether, and DisplayName to control the name used in the generated messages.

Not every rejection comes from a data annotation, though - a name a server reports as taken, a rule that needs two fields to be compared, a field that lives outside any form at all. Invalid forces the same state from the outside: the same red frame, the same focus ring and the same aria-invalid, without an EditContext being involved. It only ever adds to the validation of the field, so a value the EditContext already rejected stays invalid whatever the parameter says.

ErrorMessage is what turns that red frame into something the reader can act on: the text is rendered under the field, above the description and the counter, and setting it marks the field invalid on its own - there is no need to also set Invalid. It is referenced by the input through aria-describedby ahead of the description, and announced by the live region of the field the moment it shows up, so a rejection that arrives while the field still has focus is not something only sighted users learn about. ErrorMessageTemplate replaces the text with content of its own, shown in the Templates section. Both are meant for the rejections the app knows about; inside an EditForm the messages of the data annotations belong to the ValidationMessage component instead, so the same text is not printed twice.


Anything without a space in it is rejected.


That user name is already taken.
That user name is already taken.

A user name cannot contain a space.
Letters and digits only.
8/20
A user name cannot contain a space.

'not-an-email' is not an email address.
The message shows up as soon as the value stops looking like an email address.
'not-an-email' is not an email address.







Background

Background picks the fill of the field from the color kinds of the theme. Transparent is the one to use when the field sits on a colored surface and should inherit it instead of punching a light rectangle into it.




Border

Border picks the color of the frame from the same color kinds, independently of the background. Transparent keeps the border box - and therefore the layout - while making the line itself invisible, which is the difference between it and NoBorder.




Accent

Accent is the color the field takes on while it has focus: the focus ring, the icon and the affixes all follow it. Primary is the default, and the remaining variants are what gives a field a meaning of its own - a success green on a confirmed value, an error red on a rejected one - without touching the rest of the theme.

















External Icons

The Icon parameter takes a BitIconInfo instead of a built-in icon name, which is what lets an icon come from FontAwesome, Bootstrap Icons or any other icon font: BitIconInfo.Fa and BitIconInfo.Bi build the class names of those two libraries, BitIconInfo.Css takes the classes verbatim, and a plain string is implicitly converted to one. The same applies to ClearButtonIcon, RevealPasswordIcon and HidePasswordIcon.


FontAwesome:







Bootstrap:




Size

Size scales the whole field at once - its height, its font, its icons and its buttons - so a field stays proportional to the controls next to it. Medium is the default; Small is what a dense toolbar or a table row wants, and Large is what a landing page form wants.





Style & Class

Style and Class land on the root element, while Styles and Classes reach every inner part by name - the label, the field group, the input, the buttons, the footer and the counter - which is what makes a fully custom look possible without overriding the stylesheet. Focused is applied to the root only while the field has focus, so a floating label can be driven entirely from these two parameters.


Component's Style & Class:





Styles & Classes:


RTL

Set Dir="BitDir.Rtl" to mirror the field for a right-to-left language. The label, the affixes, the buttons, the required asterisk and the underline all follow the direction, since the layout is written with logical properties rather than left and right ones.





3/20

API

Every parameter, public member, sub-class and enum this component exposes.

BitTextField parameters

Name Type Default value Description
Accent BitColor? null The general color of the text field used when focused.
AriaDescription string? null Detailed description of the input for the benefit of screen readers. It is rendered into a visually hidden element that the input references through its aria-describedby attribute, which is what lets a field carry an instruction that would be too long to show next to it.
AutoCapitalize string? null Sets the autocapitalize html attribute of the input element, which tells the on-screen keyboard of a mobile device whether and how the typed text should be capitalized automatically. Accepted values are "off", "none", "on", "sentences", "words" and "characters".
AutoCorrect bool? null Sets the autocorrect html attribute of the input element, which turns the automatic correction of the typed text on or off. Useful to turn off for identifiers, codes and other non-prose values.
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.
ClearButtonAriaLabel string? null The aria-label of the clear button, which is what a screen reader announces for it since the button only holds an icon. Defaults to "Clear text".
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.
ClearButtonTemplate RenderFragment? null The custom content of the clear button, which replaces its icon.
CountStrategy Func<string?, int>? null Decides how the characters of the value are counted for the counter rendered by ShowCount. Leaving it unset counts the value the way the browser counts it against MaxLength - in UTF-16 code units - which makes an emoji count as two and a flag as four. A strategy of its own counts them the way the rest of the app does instead, for instance v => new StringInfo(v ?? string.Empty).LengthInTextElements to count what a reader actually sees. It only changes the number that is shown: the html maxlength attribute keeps holding the keyboard back at its own count.
CountTemplate RenderFragment<int>? null The custom content of the character counter, which receives the current number of characters and replaces the default "count/maxLength" text.
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.
EnterKeyHint string? null Sets the enterkeyhint html attribute of the input element, which decides the label of the return key of an on-screen keyboard. Accepted values are "enter", "done", "go", "next", "previous", "search" and "send".
ErrorMessage string? null The message shown under the field when the value was rejected. Setting it marks the field invalid on its own - the same look and the same aria-invalid attribute Invalid gives it - and the message is referenced by the input through its aria-describedby attribute and announced by the live region of the field.
ErrorMessageTemplate RenderFragment? null The custom content of the error message, which replaces the plain ErrorMessage text and marks the field invalid in the same way. Only the plain text is announced by the live region, since a template is free to render anything at all.
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.
IconAriaLabel string? null The accessible name of the icon shown at the trailing end of the text field. The icon is decorative and hidden from assistive technologies by default; setting this turns it into an image with a name, which is what an icon carrying a meaning of its own needs.
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.
Invalid bool false Marks the value of the field as invalid, which gives a value rejected by something other than the cascading EditContext - a server, a rule of the app, a validator of its own - the same look and the same aria-invalid attribute that a failing data annotation gives it. A field failing its own validation stays invalid regardless of this parameter.
Label string? null Label displayed above the text field and read by screen readers.
LabelPosition BitLabelPosition? null Where the label sits relative to the input. Leaving it unset keeps the layout each variant comes with: above the input in the default one, and next to it in the Underlined one.
LabelTemplate RenderFragment? null Shows the custom label for text field.
Loading bool false Shows a busy indicator inside the field, which is what tells the user that something is running against what was typed - a suggestion being fetched, a value being checked against a server. The field stays editable while it is on, so the typing is never interrupted by it.
LoadingAriaLabel string? null What a screen reader announces while Loading is on, in place of the default "Loading". It is announced whichever indicator is drawn, so a LoadingTemplate drawing a bare spinner of its own still tells an assistive technology that something is running.
LoadingTemplate RenderFragment? null The custom content of the busy indicator, which replaces the default spinner.
MaxLength int -1 Specifies the maximum number of characters allowed in the input. A negative value (the default) removes the limit and renders no maxlength attribute.
MaxRows int? null The maximum number of rows the input grows to in the Multiline mode while AutoHeight is enabled. Beyond that height the input keeps its size and scrolls its content instead of pushing the rest of the page down. A null value (the default) lets the input grow indefinitely.
MinLength int -1 Specifies the minimum number of characters the input accepts, which is what the browser validates the value against before the form is submitted. A negative value (the default) removes the constraint and renders no minlength attribute.
Multiline bool false Whether or not the text field is a Multiline text field.
NoBorder bool false Removes the border of the text input.
OnBlur EventCallback<FocusEventArgs> Callback for when the input loses focus. Unlike OnFocusOut it does not bubble, so it is the one to use when only the input itself losing focus is of interest.
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.
OnEscape EventCallback<KeyboardEventArgs> Callback for when the Escape key is pressed while input has focus.
OnFocus EventCallback<FocusEventArgs> Callback for when the input receives focus. Unlike OnFocusIn it does not bubble, so it is the one to use when only the input itself receiving focus is of interest.
OnFocusIn EventCallback<FocusEventArgs> Callback for when focus moves into the input or any of its descendants, since unlike OnFocus it bubbles.
OnFocusOut EventCallback<FocusEventArgs> Callback for when focus moves out of the input or any of its descendants, since unlike OnBlur it bubbles.
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.
OnInput EventCallback<ChangeEventArgs> Callback for every input event of the input element, which is what lets a field watch the text as it is typed without having to turn Immediate on and commit the value along with it. It is raised before the value is committed and is not held back by DebounceTime or ThrottleTime, and it is not raised for the half-composed text of an input method editor.
OnKeyDown EventCallback<KeyboardEventArgs> Callback for when a keyboard key is pressed.
OnKeyUp EventCallback<KeyboardEventArgs> Callback for When a keyboard key is released.
Pattern string? null Sets the pattern html attribute of the input element, which is the regular expression the value is checked against by the browser before the form is submitted.
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. It stays the same in both states on purpose: the pressed state of the button is what tells a screen reader whether the password is currently revealed. Defaults to "Reveal password".
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.
RevealPasswordTemplate RenderFragment<bool>? null The custom content of the reveal password button, which receives whether the password is currently revealed and replaces the default icon.
Rows int? null For multiline text, Number of rows.
SelectOnFocus bool false Selects the whole value when the input receives focus, so that the next keystroke replaces it. It is what a field holding a value the user is expected to overwrite rather than edit - a search term, a quantity, a generated code - usually wants.
ShowClearButton bool false Whether to show the clear button while the input holds any text. The button follows what the input reports rather than the bound value, so it is there from the first keystroke even on a field that only commits its value when it loses focus.
ShowCount bool false Shows the number of characters that were typed under the text field, followed by the MaxLength when one is set. A count above the limit - only reachable from the code, since the maxlength attribute holds the keyboard back - is colored like a rejected value.
Size BitSize? null The size of the text field.
SpellCheck bool? null Sets the spellcheck html attribute of the input element, which turns the spell checking of the browser on or off for this input.
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.
Title string? null A more descriptive title of the text field, shown by the browser as its tooltip.
Trim bool false Specifies whether to remove any leading or trailing whitespace from the value. The trimming happens when the input reports a change, which is what lets a space still be typed in the middle of a word while Immediate is enabled.
Type BitInputType? null Input type.
Underlined bool false Whether or not the text field is underlined.
Wrap string? null Sets the wrap html attribute of the textarea rendered in the Multiline mode, which decides how the text is wrapped and whether the breaks the wrapping adds travel with the value when a form is submitted. Accepted values are "soft" (what a browser does on its own), "hard" and "off", the last of which turns the wrapping off entirely and scrolls long lines sideways instead.

BitTextField public members

Name Type Default value Description
InputElement ElementReference The ElementReference to the input element of the BitTextField.
ClearAsync Task Empties the text field and raises OnClear, exactly as the clear button does (without requiring ShowClearButton, since there is no button involved). It does nothing while the field is disabled or read-only.
FocusAsync ValueTask Gives focus to the input element of the BitTextField. The overload taking a preventScroll flag focuses it without scrolling the document to bring it into view.
SelectAsync ValueTask Selects the whole value of the input, the programmatic counterpart of SelectOnFocus.
SelectRangeAsync ValueTask Selects the text between the two given positions, or moves the caret when they are equal. A null start counts from the beginning of the value and a null end runs to its very end, and both are clamped to the length of the value.
ToggleRevealPassword void Toggles the revealed state of the value while the type of the input is password and CanRevealPassword is enabled.

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.
Loading string? null Custom CSS classes/styles for the BitTextField's busy indicator container.
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.
ErrorMessageContainer string? null Custom CSS classes/styles for the BitTextField's error message container.
ErrorMessage string? null Custom CSS classes/styles for the BitTextField's error message.
Footer string? null Custom CSS classes/styles for the BitTextField's footer, which holds the description and the character counter.
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.
Count string? null Custom CSS classes/styles for the BitTextField's character counter.
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.

BitLabelPosition enum

Name Value Description
Top 0 The label sits above the input.
End 1 The label sits after the input, on the same line.
Bottom 2 The label sits under the input.
Start 3 The label sits before the input, on the same line.

BitSize enum

Name Value Description
Small 0 The small size.
Medium 1 The medium size.
Large 2 The large size.

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.
Email 3 The input expects email characters.
Tel 4 The input expects tel characters.
Url 5 The input expects url characters.
Search 6 The input expects a search term, which is what lets a browser offer the previous searches of the same field and show its own clear affordance.

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.
Email 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

Found a mistake, a gap, or something that could be clearer? Every page and every component is one click from its source.