UI Widgets TextArea

A widget used to display and edit multi-line text.

Included in: dx.phonejs.js, dx.webappjs.js, dx.all.js

The dxTextArea widget is a multi-line resizable text field.

You can create a widget using one of the following approaches.

  • jQuery
    Use the dxTextArea jQuery plug-in.

    HTML
    <div id="textArea"></div>
    JavaScript
    $("#textArea").dxTextArea({
        value: 'Text displayed by the widget',
        maxLength: 300,
        height: 400
    });
  • Knockout
    Add a div element and apply the dxTextArea binding to this element.

    HTML
    <div data-bind="dxTextArea: {
        value: 'Text displayed by the widget',
        maxLength: 300,
        height: 400
    }"></div>
  • Angular
    Add a div element and apply the dx-text-area directive to this element.

    HTML
    <div dx-text-area="{
        value: 'Text displayed by the widget',
        maxLength: 300,
        height: 400
    }"></div>

Note that DevExtreme widgets require you to link the jQuery and Globalize libraries to your application. If you use the Knockout or Angular approach, the Knockout or Angular library is also required.

See Also

You can find detailed information on the principles of working with the widget in the dxTextArea section of the Editor Widgets article.

View Demo

Show Example:
AngularJS
Knockout
jQuery
<div ng-controller="demoController" style="height: 100%;">
    <div dx-text-area="{ 
        height: 300,
        bindingOptions: {
            value: 'text'
        }
    }"></div>
</div>
var myApp = angular.module('myApp', ['dx']);
myApp.controller("demoController", function ($scope) {
    $scope.text = "";
    $.ajax({
        type: "POST",
        url: "/LoremService.asmx/LoremIpsum",
        data: JSON.stringify({ count: 1 }),
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (data) {
            $scope.text = data.d[0];
        }
    });
});
angular.element(document).ready(function () {
    angular.bootstrap(document, ['myApp']);
});
body{
    text-align: center;
}
.dx-textarea{
    margin: 10px;
}
<div data-bind="dxTextArea: { value: text, height: 300 }"></div>
var myViewModel = {
    text: ko.observable("")
}
ko.applyBindings(myViewModel);
$.ajax({
    type: "POST",
    url: "/LoremService.asmx/LoremIpsum",
    data: JSON.stringify({ count: 1 }),
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function (data) {
        myViewModel.text(data.d[0]);
    }
});
body{
    text-align: center;
}
.dx-textarea{
    margin: 10px;
}
<div id="myTextArea"></div>
$("#myTextArea").dxTextArea({
    height: 300
});
$.ajax({
    type: "POST",
    url: "/LoremService.asmx/LoremIpsum",
    data: JSON.stringify({ count: 1 }),
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function (data) {
        $("#myTextArea").dxTextArea("instance").option("text", data.d[0]);
        $("#myTextArea").dxTextArea("instance").repaint();
    }
});
body{
    text-align: center;
}
.dx-textarea{
    margin: 10px;
}

Configuration

An object defining configuration options for the dxTextArea widget.

Methods

This section describes the members used to manipulate the widget.

Events

This section describes events exposed by this widget.