Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Included UG for OtpInput #204

Open
wants to merge 21 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
f885c5e
Included Otp-Input/Getting-Started.md
ShyamSundar-SF4699 Jan 21, 2025
fd47529
Included Otp-Input/Input-Types.md
ShyamSundar-SF4699 Jan 21, 2025
104b860
Included Otp-Input/Styling-Modes.md
ShyamSundar-SF4699 Jan 21, 2025
ce61c53
Included Otp-Input/OtpInput-Customization.md
ShyamSundar-SF4699 Jan 21, 2025
764fcea
Updated maui-toolkit-toc.html
ShyamSundar-SF4699 Jan 21, 2025
31b493c
Updated maui-toolkit-toc.html
ShyamSundar-SF4699 Jan 21, 2025
194ac56
Included Otp-Input/Events.md
ShyamSundar-SF4699 Jan 21, 2025
26ce7d2
Included Otp-Input/accessibility.md
ShyamSundar-SF4699 Jan 21, 2025
047ac65
Updated maui-toolkit-toc.html
ShyamSundar-SF4699 Jan 21, 2025
209aba7
Included Otp-Input/Overview.md
ShyamSundar-SF4699 Jan 22, 2025
3b6e9c2
Updated description
ShyamSundar-SF4699 Jan 22, 2025
8786976
Updated description
ShyamSundar-SF4699 Jan 22, 2025
f79dbcc
Removed Otp-Input/accessibility.md
ShyamSundar-SF4699 Jan 22, 2025
717698f
Updated suggested changes
ShyamSundar-SF4699 Jan 22, 2025
d658a8a
Addressed the feedbacks
ShyamSundar-SF4699 Jan 22, 2025
146d0e8
Updated Otp-Input/OtpInput-Customization.md
ShyamSundar-SF4699 Jan 22, 2025
1ff12ef
Updated Otp-Input/OtpInput-Customization.md
ShyamSundar-SF4699 Jan 22, 2025
44ecada
Merge branch 'development' of https://github.com/syncfusion-content/m…
naveenkumar-sanjeevirayan Jan 23, 2025
b11926c
Reviewed the OtpInput content
naveenkumar-sanjeevirayan Jan 23, 2025
4594cbb
Included Otp-Input/Accessibility.md
ShyamSundar-SF4699 Jan 23, 2025
fc6c96c
Included Otp-Input/Accessibility.md
ShyamSundar-SF4699 Jan 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions maui-toolkit-toc.html
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,17 @@
<li><a href="/maui-toolkit/NumericUpDown/Events">Events</a></li>
</ul>
</li>
<li>
SfOtpInput
<ul>
<li><a href="/maui-toolkit/Otp-Input/Overview">Overview</a></li>
<li><a href="/maui-toolkit/Otp-Input/Getting-Started">Getting Started</a></li>
<li><a href="/maui-toolkit/Otp-Input/Input-Types">Input Types</a></li>
<li><a href="/maui-toolkit/Otp-Input/Styling-Modes">Styling Modes</a></li>
<li><a href="/maui-toolkit/Otp-Input/OtpInput-Customization">Customization</a></li>
<li><a href="/maui-toolkit/Otp-Input/Events">Events</a></li>
</ul>
</li>
<li>
SfPolarChart
<ul>
Expand Down
37 changes: 37 additions & 0 deletions maui-toolkit/Otp-Input/Events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
layout: post
title: Events in .NET MAUI OtpInput control | Syncfusion®
description: Learn about event support in Syncfusion® Toolkit for .NET MAUI OtpInput (SfOtpInput) control and more.
platform: maui-toolkit
control: OtpInput
documentation: ug
---

# Event in .NET MAUI OtpInput (SfOtpInput)

## ValueChanged event

The OtpInput component triggers the `ValueChanged` event when the value of each OtpInput is changed. The `OtpInputValueChangedEventArgs` passed as an event argument provides the details of the each value is changed.

{% tabs %}
{% highlight xaml %}

<otp:SfOtpInput ValueChanged="OnValueChanged"></otp:SfOtpInput>

{% endhighlight %}
{% highlight c# %}

SfOtpInput otpInput = new SfOtpInput();
otpInput.ValueChanged += OnValueChanged;

{% endhighlight %}
{% endtabs %}

{% highlight c# %}

private void OnValueChanged(object sender, OtpInputValueChangedEventArgs e)
{
// Codes that need to be executed once the input value is Changed.
}

{% endhighlight %}
107 changes: 107 additions & 0 deletions maui-toolkit/Otp-Input/Getting-Started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
---
layout: post
title: Getting started with .NET MAUI OtpInput control | Syncfusion®
description: Learn here about getting started with Syncfusion® .NET MAUI OtpInput (SfOtpInput) control in your cross-platform applications.
platform: maui-toolkit
control: OtpInput
documentation: ug
---

# Getting Started with .NET MAUI OtpInput

This section provides a quick overview of how to get started with the `OtpInput` for .NET MAUI and a walk-through to configure the .NET MAUI OtpInput in a real-time scenario. Follow the steps below to add .NET MAUI OtpInput to your project.

## Prerequisites
naveenkumar-sanjeevirayan marked this conversation as resolved.
Show resolved Hide resolved

Before proceeding, ensure the following are set up:

1. Install [.NET 8 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) or later is installed.
2. Set up a .NET MAUI environment with Visual Studio 2022 (v17.8 or later) or Visual Studio Code. For Visual Studio Code users, ensure that the .NET MAUI workload is installed and configured as described [here.](https://learn.microsoft.com/en-us/dotnet/maui/get-started/installation?view=net-maui-8.0&tabs=visual-studio-code)

## Step 1: Create a New MAUI Project

{% tabcontents %}
{% tabcontent Visual Studio %}

1. Go to **File > New > Project** and choose the **.NET MAUI App** template.
2. Name the project and choose a location. Then, click **Next.**
3. Select the .NET framework version and click **Create.**

{% endtabcontent %}
{% tabcontent Visual Studio Code %}

1. Open the command palette by pressing `Ctrl+Shift+P` and type **.NET:New Project** and enter.
2. Choose the **.NET MAUI App** template.
3. Select the project location, type the project name and press **Enter.**
4. Then choose **Create project.**

{% endtabcontent %}
{% endtabcontents %}

## Step 2: Install the Syncfusion<sup>®</sup> MAUI Toolkit Package

{% tabcontents %}
{% tabcontent Visual Studio %}

1. In **Solution Explorer,** right-click the project and choose **Manage NuGet Packages.**
2. Search for [Syncfusion.Maui.Toolkit](https://www.nuget.org/packages/Syncfusion.Maui.Toolkit/) and install the latest version.
3. Ensure the necessary dependencies are installed correctly, and the project is restored.

{% endtabcontent %}
{% tabcontent Visual Studio Code %}

1. Press <kbd>Ctrl</kbd> + <kbd>`</kbd> (backtick) to open the integrated terminal in Visual Studio Code.
2. Ensure you're in the project root directory where your .csproj file is located.
3. Run the command `dotnet add package Syncfusion.Maui.Toolkit` to install the Syncfusion<sup>®</sup> .NET MAUI Toolkit NuGet package.
4. To ensure all dependencies are installed, run `dotnet restore`.

{% endtabcontent %}
{% endtabcontents %}

## Step 3: Register the handler

In the MauiProgram.cs file, register the handler for Syncfusion<sup>®</sup> Toolkit.

{% tabs %}
{% highlight C# tabtitle="MauiProgram.cs" hl_lines="1 9" %}
using Syncfusion.Maui.Toolkit.Hosting;

public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.ConfigureSyncfusionToolkit()
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
});

return builder.Build();
}
}

{% endhighlight %}
{% endtabs %}

## Step 4: Add a Basic OtpInput

1. To initialize the control, import the `Syncfusion.Maui.Toolkit.OtpInput` namespace into your code.

2. Initialize `SfOtpInput`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initialize SfOtpInput.


{% tabs %}
{% highlight xaml %}

<otp:SfOtpInput></otp:SfOtpInput>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

otpInput:SfOtpInput</otpInput:SfOtpInput>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@naveenkumar-sanjeevirayan
Will update the xmlns name to otpInput as suggested


{% endhighlight %}
{% highlight c# %}

SfOtpInput otpInput = new SfOtpInput();

{% endhighlight %}
{% endtabs %}
97 changes: 97 additions & 0 deletions maui-toolkit/Otp-Input/Input-Types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
---
layout: post
title: Input Types in .NET MAUI OtpInput | Syncfusion®
description: Learn here about input types in Syncfusion® .NET MAUI OtpInput (SfOtpInput) control in your cross-platform applications.
platform: maui-toolkit
control: OtpInput
documentation: ug
---

# Input Types in Blazor OTP Input component
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Input Types in Maui OTP Input


## Types

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

### Number type

You can set the `Type` property to `Number` to use this input type as number. This is ideal for OtpInput scenarios with numeric-only codes. By default `Type` property is `Number`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@naveenkumar-sanjeevirayan
Will update as suggested


{% tabs %}
{% highlight xaml %}

<otp:SfOtpInput Value="1234" Type="Number"></otp:SfOtpInput>

{% endhighlight %}
{% highlight c# %}

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

{% endhighlight %}
{% endtabs %}

### Text type

You can set the `Type` property to `Text` to use this input type as text. This is suitable when the OtpInput need to include both letters and numbers.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can set the Type property to Text for inputs that may include both letters and numbers, suitable for alphanumeric OTPs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@naveenkumar-sanjeevirayan
Will update as suggested


{% tabs %}
{% highlight xaml %}

<otp:SfOtpInput Value="e3c7" Type="Text"></otp:SfOtpInput>

{% endhighlight %}
{% highlight c# %}

SfOtpInput otpInput = new SfOtpInput()
{
Value = "1234",
Type = OtpInputType.Text
};

{% endhighlight %}
{% endtabs %}

### Password type

You can set the `Type` property to `Password` to use this input type as password in the OtpInput.

{% tabs %}
{% highlight xaml %}

<otp:SfOtpInput Value="e3c7" Type="Password"></otp:SfOtpInput>

{% endhighlight %}
{% highlight c# %}

SfOtpInput otpInput = new SfOtpInput()
{
Value = "1234",
Type = OtpInputType.Password
};

{% endhighlight %}
{% endtabs %}

## Value

You can specify the value of OtpInput by using the `Value` property.

{% tabs %}
{% highlight xaml %}

<otp:SfOtpInput Value="e3c7"></otp:SfOtpInput>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for this value, need to set Type to Text. Otherwise change the value to 1234

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@naveenkumar-sanjeevirayan
Updated as suggested


{% endhighlight %}
{% highlight c# %}

SfOtpInput otpInput = new SfOtpInput()
{
Value = "1234"
};

{% endhighlight %}
{% endtabs %}
Loading