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 : BnLayoutItem, Microsoft.AspNetCore.Components.IComponent, Microsoft.AspNetCore.Components.IHandleEvent, Microsoft.AspNetCore.Components.IHandleAfterRender
Inheritance Object → ComponentBase → BnLayoutItem → 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
BackgroundColor
Fill colour behind the component. Null leaves it transparent.
public string? BackgroundColor { get; set; }
Property Value
Margin
Space outside the component, between it and its siblings. Null = none.
public BnAutoLength? Margin { get; set; }
Property Value
Remarks:
auto is legal here and absorbs free space, which re-centres the node.
AlignSelf
Cross-axis alignment for this item alone, overriding the parent's. Null = inherit.
public FlexAlign? AlignSelf { get; set; }
Property Value
Grow
Share of leftover space this item takes (unitless ratio). Null = Yoga's default (0).
public float? Grow { get; set; }
Property Value
Shrink
Share of overflow this item gives up (unitless ratio). Null = Yoga's default (1).
public float? Shrink { get; set; }
Property Value
Basis
Starting main-axis size before grow/shrink. Null = auto.
public BnAutoLength? Basis { get; set; }
Property Value
Width
Box width. Null = auto.
public BnAutoLength? Width { get; set; }
Property Value
Height
Box height. Null = auto.
public BnAutoLength? Height { get; set; }
Property Value
MinWidth
Lower bound on width. Null = unset.
public BnLength? MinWidth { get; set; }
Property Value
MaxWidth
Upper bound on width. Null = unset.
public BnLength? MaxWidth { get; set; }
Property Value
MinHeight
Lower bound on height. Null = unset.
public BnLength? MinHeight { get; set; }
Property Value
MaxHeight
Upper bound on height. Null = unset.
public BnLength? MaxHeight { get; set; }
Property Value
Position
Positioning scheme. Null = Yoga's default (relative).
public FlexPosition? Position { get; set; }
Property Value
Top
Top inset. Null = unset.
public BnLength? Top { get; set; }
Property Value
Right
Right inset. Null = unset.
public BnLength? Right { get; set; }
Property Value
Bottom
Bottom inset. Null = unset.
public BnLength? Bottom { get; set; }
Property Value
Left
Left inset. Null = unset.
public BnLength? Left { get; set; }
Property Value
Constructors
BnInput()
public BnInput()