Class BOBInputOtp
- Namespace
- BlazOrbit.Components.Forms
- Assembly
- BlazOrbit.dll
[GenerateComponentInfo]
public class BOBInputOtp : BOBInputComponentBase<string, BOBInputOtp, BOBInputOtpVariant>, IHasReadOnly, IHasDisabled, IHasRequired, IHasError, IVariantComponent<BOBInputOtpVariant>, IVariantComponent, IPureBuiltComponent, IBuiltComponent, IHasSize, IHasColor, IHasDensity
- Inheritance
-
objectComponentBaseInputBase<string>BOBInputComponentBase<string>BOBInputOtp
- Implements
- Inherited Members
Constructors
BOBInputOtp()
public BOBInputOtp()
Properties
BuiltInTemplates
Compile-time map of variants to their built-in render templates.
protected override IReadOnlyDictionary<BOBInputOtpVariant, Func<BOBInputOtp, RenderFragment>> BuiltInTemplates { get; }
Property Value
- IReadOnlyDictionary<BOBInputOtpVariant, Func<BOBInputOtp, RenderFragment>>
Color
Foreground color of each slot. Accepts any valid CSS color value, PaletteColor or BOBColor.
[Parameter]
public string? Color { get; set; }
Property Value
- string
DefaultVariant
Variant used when no Variant is supplied.
public override BOBInputOtpVariant DefaultVariant { get; }
Property Value
Density
Vertical density (gap) between slots.
[Parameter]
public BOBDensity Density { get; set; }
Property Value
HelperText
Helper text displayed below the OTP slots for additional context.
[Parameter]
public string? HelperText { get; set; }
Property Value
- string
Label
Floating label displayed above the OTP slots.
[Parameter]
public string? Label { get; set; }
Property Value
- string
Length
Number of OTP digit slots. Defaults to 6. Range: 2–12.
[Parameter]
public int Length { get; set; }
Property Value
- int
Mask
When true, slots are rendered as masked password fields.
[Parameter]
public bool Mask { get; set; }
Property Value
- bool
Numeric
When true (default), only digit characters are accepted.
[Parameter]
public bool Numeric { get; set; }
Property Value
- bool
OnComplete
Raised once when every slot is filled and the resulting code parses successfully. Fires exactly once per fill cycle; backspacing and refilling triggers a new event.
[Parameter]
public EventCallback<string> OnComplete { get; set; }
Property Value
- EventCallback<string>
Size
Visual size of the OTP input.
[Parameter]
public BOBSize Size { get; set; }
Property Value
Methods
BuildComponentCssVariables(Dictionary<string, string>)
Contributes additional CSS custom properties to the inline style attribute. Keys
that collide with framework-owned --bob-inline-* variables will be overwritten.
public void BuildComponentCssVariables(Dictionary<string, string> cssVariables)
Parameters
cssVariablesDictionary<string, string>
BuildComponentDataAttributes(Dictionary<string, object>)
Contributes additional data- attributes to the root element. Keys that collide
with framework-owned data-bob- attributes will be overwritten.
public void BuildComponentDataAttributes(Dictionary<string, object> dataAttributes)
Parameters
dataAttributesDictionary<string, object>
BuildRenderTree(RenderTreeBuilder)
Renders the component to the supplied Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder.
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
__builderRenderTreeBuilder
OnParametersSet()
Method invoked when the component has received parameters from its parent in the render tree, and the incoming values have been assigned to properties.
protected override void OnParametersSet()
TryParseValueFromString(string?, out string, out string?)
Parses a string to create an instance of string. Derived classes can override this to change how Microsoft.AspNetCore.Components.Forms.InputBase<TValue>.CurrentValueAsString interprets incoming values.
protected override bool TryParseValueFromString(string? value, out string result, out string? validationErrorMessage)
Parameters
valuestringThe string value to be parsed.
resultstringAn instance of string.
validationErrorMessagestringIf the value could not be parsed, provides a validation error message.
Returns
- bool
True if the value could be parsed; otherwise false.