BnInput
Namespace: BlazorNative.Components
A single-line text box. Renders as a native EditText on Android and a
UITextField on iOS.
public sealed class BnInput : Microsoft.AspNetCore.Components.ComponentBase, Microsoft.AspNetCore.Components.IComponent, Microsoft.AspNetCore.Components.IHandleEvent, Microsoft.AspNetCore.Components.IHandleAfterRender
Inheritance Object → ComponentBase → BnInput
Implements IComponent, IHandleEvent, IHandleAfterRender
Attributes NullableContextAttribute, NullableAttribute
Remarks:
It exposes the BnInput.Value / BnInput.ValueChanged pair, which
is what @bind-Value needs — so binding is the ordinary Blazor syntax:
<BnInput @bind-Value="_name" Placeholder="Your name" />
@code {
private string _name = "";
}
You can also wire the two halves by hand — BnInput.Value in, BnInput.ValueChanged out — when you need to intercept the edit.
Properties
Value
The current text. Null is sent as an empty string, so the text box always has a definite value.
public string? Value { get; set; }
Property Value
ValueChanged
Raised with the new text when the user edits the box — the
write-back half of the @bind-Value pair.
public EventCallback<string> ValueChanged { get; set; }
Property Value
Placeholder
Hint text shown while the box is empty. Null = none.
public string? Placeholder { get; set; }
Property Value
Enabled
Set false to show the platform's disabled text box and stop it accepting input. Default true.
public bool Enabled { get; set; }
Property Value
OnFocus
Raised when the text box gains focus. Optional: nothing is attached to the native control unless you supply a handler.
public EventCallback<FocusEventArgs> OnFocus { get; set; }
Property Value
OnBlur
Raised when the text box loses focus. Optional, like BnInput.OnFocus.
public EventCallback<FocusEventArgs> OnBlur { get; set; }
Property Value
Constructors
BnInput()
public BnInput()