# Label Overview

The Label enables you to associate a `label` HTML element with the TextArea.

* [Demo page for the TextArea Floating Label](https://demos.telerik.com/aspnet-core/textarea/floating-label)

## Basic Usage

To associate a TextArea with a Label, use the `Content()` method of the `TextAreaLabelSettingsBuilder`.

## Initializing the Label for the TextArea

The Label exposes a `Content()` method that sets the inner HTML of the `label` element.

The below example shows how to create a Label from a string.

```Razor HtmlHelper
    @(Html.Kendo().TextArea()
        .Name("TextArea")
        .Label(l => l.Content("First name"))
    )
```

```Razor TagHelper
    <kendo-textarea name="FirstName">
        <label floating="true" content="Description"/>
    </kendo-textarea>
```

The below example shows how to create a Label from a function by using the `ContentHandler()` method. The function context (available via the `this` keyword) will be set to the widget instance.

```Razor HtmlHelper
    @(Html.Kendo().TextArea()
            .Name("TextArea")
            .Label(l => l.ContentHandler("labelContentHandler"))
    )
    <script>
        function labelContentHandler() {
            return "First name"
        }
    </script>
```

```Razor TagHelper
    <kendo-textarea name="FirstName">
        <label content-handler="labelContentHandler" />
    </kendo-textarea>
    <script>
        function labelContentHandler() {
            return "First Name"
        }
    </script>
```

## Floating Label

The Floating Label enables you to provide a floating label functionality to the TextArea.

The following example demonstrates how to set a Floating Label for a TextArea.

```Razor HtmlHelper
    @(Html.Kendo().TextArea()
           .Name("TextArea")
           .Label(label =>
           {
               label.Content("First name");
               label.Floating(true);
           })
    )
```

```Razor TagHelper
    <kendo-textarea name="FirstName">
        <label content="First Name" floating="true" />
    </kendo-textarea>
```

If set to `true`, the component will be wrapped in a container that will allow the floating label functionality.

> **Important:** The [value](https://docs.telerik.com/kendo-ui/api/ui/textarea/methods/value) client-side method **does not trigger** the `focusout` event of the input.

This could affect the floating label functionality.
You can overcome this behavior by manually invoking the `refresh` method of the Floating Label: `$("#textarea").data("kendoTextArea").floatingLabel.refresh();`

## See Also

* [Server-Side API](https://www.telerik.com/aspnet-core-ui/documentation/api/textarea)
* [Using the API of the TextArea HtmlHelper for ASP.NET Core (Demo)](https://demos.telerik.com/aspnet-core/textarea/api)
