Text field

An implementation of a text field. The <FluentTextField> supports two visual appearances, outline and filled, with the control defaulting to the outline appearance.

<FluentTextField> wraps the <fluent-text-field> element, a web component implementation of a text field leveraging the Fluent UI design system.

Note: With the TextFieldType.Password some warnings might show up in your browser's developer tools about non-uniques id's being used. The warning is wrong. The (Chromium) dev tools are not taking the shadow DOM into consideration when scanning for unique id's. Each id=control is being applied in a component' shadow DOM and is unique to that component.
Chromium is doing some fancy extra check (with a link on creating beautiful login forms) whichwe can not prevent and the warning cannot be removed from our side.

Examples

Default

Example

Without label:

You entered:

With label:

You entered:

Minlength

You entered:

Maxlength

You entered:

Download: 

Displays

Example

Full Width

Placeholder

Download: 

States

Example

Required

Disabled

label

Read only

label
Download: 

Icons

Example

With start

With end

Download: 

Types

Example

Password

Password

Email (with spellcheck)

Email (with spellcheck)

Telephone number

Telephone

Url

Url

Text with InputMode

Text with InputMode

Color picker

Color picker

Search input

Search

Numeric

Number
Download: 

Focus

Example

Autofocus

Commented out to prevent page actually jumping to this location. See example code below for implementation.

Focus Async

FocusAsync
Download: 

Filled Appearance

Example

Default

label

Placeholder

Required

Disabled

label

Read only

label
Download: 

Documentation

FluentTextField Class

Inherits from FluentInputBase<string?>.
There might be parameters and/or methods shown here that are inherited from the component's base type but are not applicable to this component.

Parameters

Name
Type
Default
Description
AppearanceFluentInputAppearance
Outline
Gets or sets the visual appearance. See FluentInputAppearance
AriaLabelstring?
Gets or sets the text used on aria-label attribute.
AutoCompletestring?
Specifies whether a form or an input field should have autocomplete 'on' or 'off' or another value.
An Id value must be set to use this property.
Autofocusbool
False
Determines if the element should receive document focus on page load.
ChildContentRenderFragment?
Gets or sets the content to be rendered inside the component.
DataListstring?
Allows associating a datalist to the element by id.
Disabledbool
False
Disables the form control, ensuring it doesn't participate in form submission.
DisplayNamestring?
Gets or sets the display name for this field.
This value is used when generating error messages when the input value fails to parse correctly.
Embeddedbool
False
Gets or sets if the derived component is embedded in another component.
If true, the ClassValue property will not include the EditContext's FieldCssClass.
FieldFieldIdentifier?
Gets or sets the FluentInputBase.FieldIdentifier that identifies the bound value.
If set, this parameter takes precedence over FluentInputBase.ValueExpression.
Immediatebool
False
Change the content of this input field when the user write text (based on 'OnInput' HTML event).
ImmediateDelayint
0
Gets or sets the delay, in milliseconds, before to raise the FluentInputBase.ValueChanged event.
InputModeInputMode?
Gets or sets the type of data that can be entered by the user when editing the element or its content. This allows a browser to display an appropriate virtual keyboard. Not supported by Safari.
Labelstring?
Gets or sets the text to label the input.
This is usually displayed just above the input
LabelTemplateRenderFragment?
Gets or sets the content to label the input component.
This is usually displayed just above the input
Maxlengthint?
Gets or sets the maximum length.
Minlengthint?
Gets or sets the minimum length.
Namestring?
Gets or sets the name of the element.
Allows access by name from the associated form.
⚠️ This value needs to be set manually for SSR scenarios to work correctly.
Patternstring?
Gets or sets a regular expression that the value must match to pass validation.
Placeholderstring?
Gets or sets the short hint displayed in the input before the user enters a value.
ReadOnlybool
False
When true, the control will be immutable by user interaction. readonly HTML attribute for more information.
Requiredbool
False
Gets or sets a value indicating whether the element needs to have a value.
Sizeint?
Gets or sets the size of the text field.
Spellcheckbool?
Gets or sets a value indicating whether spellcheck should be used.
TextFieldTypeTextFieldType?
Gets or sets the text filed type. See TextFieldType
Valuestring?
Gets or sets the value of the input. This should be used with two-way binding.
ValueExpressionExpression<Func<string>>?
Gets or sets an expression that identifies the bound value.

EventCallbacks

Name
Type
Description
ValueChangedEventCallback<string>
Gets or sets a callback that updates the bound value.

Methods

Name
Parameters
Type
Description
FocusAsyncvoid
Exposes the elements FocusAsync(bool preventScroll) method.
FocusAsyncbool preventScroll
void
Exposes the elements FocusAsync(bool preventScroll) method.
Filled
Outline
None
Text
Decimal
Numeric
Telephone
Search
Email
Url
Text
Email
Password
Tel
Url
Color
Search
Number
An error has occurred. This application may no longer respond until reloaded. Reload 🗙