# Getting Started with the Signature

This tutorial explains how to set up a basic Telerik UI for ASP.NET Core Signature component and highlights the major steps in the configuration of the component.

You will initialize a Signature component and change its line color. Then, you will use the events of the UI component. Finally, you can run the sample code in [Telerik REPL](https://netcorerepl.telerik.com/) and continue exploring the components.

![Sample Telerik UI for ASP.NET Core Signature](https://www.telerik.com/aspnet-core-ui/documentation/assets/34df05661d9c8ba67c3ddcb7d796171d/signature-getting-started.png)

## Prerequisites

To successfully complete the tutorial, you need a project that is already configured to use the Telerik UI for ASP.NET Core components:

* You can use the [Telerik REPL](https://netcorerepl.telerik.com/) playground and skip installing the components on your system and configuring a project.

* You can prepare a Visual Studio project by following the following guide:

  * Creating a new pre-configured project for the Telerik UI for ASP.NET Core components from [a project template](https://www.telerik.com/aspnet-core-ui/documentation/vs-integration/new-project-wizard).

## 1. Prepare the CSHTML File

The first step is to add the required directives at the top of the `.cshtml` document:

* To use the Telerik UI for ASP.NET Core HtmlHelpers:

  ```cshtml
  @using Kendo.Mvc.UI
  ```

* To use the Telerik UI for ASP.NET Core TagHelpers:

  ```cshtml
  @addTagHelper *, Kendo.Mvc
  ```

Optionally, you can structure the document by adding the desired HTML elements like headings, divs, paragraphs, and others.

```Razor HtmlHelper
 @using Kendo.Mvc.UI

<h4>Signature with Color</h4>
<div>

</div>
```

```Razor TagHelper
    @addTagHelper *, Kendo.Mvc

    <h4>Signature with Color</h4>
    <div>

    </div>
```

## 2. Initialize the Signature

Use the Signature HtmlHelper or TagHelper to add the component to a page:

* The `Name()` configuration method is mandatory as its value is used for the `id` and the `name` attributes of the Signature element.
* The `Width()` setting allows you to declare the width size of the component.
* The `Height()` setting allows you to declare the height size of the component.
* The `Color()` configuration allows you define the color of the Signature line.

```Razor HtmlHelper
 @using Kendo.Mvc.UI

<h4>Signature with Color</h4>
<div>
    @(Html.Kendo().Signature()
        .Name("signature")
        .Color("crimson")
        .Width(600)
        .Height(340))
</div>
```

```Razor TagHelper
@addTagHelper *, Kendo.Mvc

<h4>Signature with Color</h4>
<div>
    <kendo-signature name="signature" color="crimson"
       width="600" height="340">
    </kendo-signature>
</div>
```

## 3. Handle a Signature Event

The Signature component provides convenient events for implementing your desired logic. In this tutorial, you will use the exposed `Change()` event to log a new entry in the browser's console.

```Razor HtmlHelper
 @using Kendo.Mvc.UI

<script>
   function onChange() {
      console.log("Signature has changed!");
   }
</script>

<h4>Signature with Color</h4>
<div>
    @(Html.Kendo().Signature()
        .Name("signature")
        .Color("crimson")
        .Width(600)
        .Height(340)
        .Events(e => e.Change("onChange"))
    )
</div>
```

```Razor TagHelper
@addTagHelper *, Kendo.Mvc

<script>
   function onChange() {
      console.log("Signature has changed!");
   }
</script>

<h4>Signature with Color</h4>
<div>
    <kendo-signature name="signature" color="crimson"
       width="600" height="340" on-change="onChange">
    </kendo-signature>
</div>
```

## 4. (Optional) Reference Existing Signature Instances

You can reference the Signature instances that you have created and build on top of their existing configuration:

1. Use the `id` attribute of the component instance to establish a reference.

   ```JS script
   <script>
       var signatureReference = $("#signature").data("kendoSignature"); // signatureReference is a reference to the existing Signature instance of the helper.
   </script>
   ```

2. Use the [Signature client-side API](https://docs.telerik.com/kendo-ui/api/ui/signature#methods) to control the behavior of the widget. In this example, you will use the `enable` method to disable the Signature.

   ```JS script
   <script>
       var signatureReference = $("#signature").data("kendoSignature"); // signatureReference is a reference to the existing Signature instance of the helper.
       signatureReference.enable(false); 
   </script>
   ```

## Explore this Tutorial in REPL

You can continue experimenting with the code sample above by running it in the Telerik REPL server playground:

* [Sample code with the Signature HtmlHelper](https://netcorerepl.telerik.com/wHkTGRud04S8Qi7v25)
* [Sample code with the Signature TagHelper](https://netcorerepl.telerik.com/cdapwHYd04jIlB8v34)

## Next Steps

* [Customize the Appearance of the Signature](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/editors/signature/appearance)
* [Configure the Form Integration](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/editors/signature/form-integration)

## See Also

* [Using the API of the Signature for ASP.NET Core (Demo)](https://demos.telerik.com/aspnet-core/signature/api)
* [Client-Side API of the Signature](https://docs.telerik.com/kendo-ui/api/ui/signature)
* [Server-Side API of the Signature](https://www.telerik.com/aspnet-core-ui/documentation/api/signature)
* [Knowledge Base Section](https://www.telerik.com/aspnet-core-ui/documentation/knowledge-base)
