Input Types in .NET MAUI OTP Input

21 May 20251 minute to read

Types

This section explains the various types of the OTP (One-Time Password) Input component, their default behaviors, and suitable use cases.

Number type

The Type property can be set to Number, prompting the input to handle numeric-only codes. This is ideal for scenarios demanding numeric OTPs. By default, the Type property is set to Number.

<otpInput:SfOtpInput Value="1234" Type="Number" />
SfOtpInput otpInput = new SfOtpInput()
{
    Value = "1234",
    Type = OtpInputType.Number
};

Number

Text type

Set the Type property to Text for inputs that may include both letters and numbers, making it suitable for alphanumeric OTPs.

<otpInput:SfOtpInput Value="e3c7" Type="Text" />
SfOtpInput otpInput = new SfOtpInput()
{
    Value = "e3c7",
    Type = OtpInputType.Text
};

Text

Password type

Set the Type property to Password to use this input type as a password in the OTP Input, hiding user input for privacy.

<otpInput:SfOtpInput Value="e3c7" Type="Password" />
SfOtpInput otpInput = new SfOtpInput()
{
    Value = "e3c7",
    Type = OtpInputType.Password
};

Password