Tooltip Configuration

An object defining configuration options for the dxTooltip widget.

animation

An object that defines the animation options of the widget.

Type: Object
Default Value: { show: { type: 'fade', from: 0, to: 1 }, hide: { type: 'fade', to: 0 } }

Show Example:
AngularJS
Knockout
jQuery
<div ng-controller="demoController" style="height: 100%;">
    <div id="button" dx-button="{ text:'Hover over me' }" ng-mouseover="toggleTooltip()" ng-mouseout="toggleTooltip()"></div>
    <div dx-tooltip="{ 
        target: '#button',
        bindingOptions: {
            visible: 'tooltipVisible',
            animation: {
                deep: false,
                dataPath: 'animationConfig'
            }
        }
    }">
        <div data-options="dxTemplate:{ name: 'content' }">
            <p>This is a button.</p>
        </div>
    </div>
    <div class="dx-fieldset">
        <div class="dx-field">
            <div class="dx-field-label">Animation type</div>
            <div class="dx-field-value" dx-select-box="{ 
                items: animationTypes,
                onValueChanged: typeChanged,
                value: 'fade'
            }"></div>
        </div>
    </div>
</div>
var myApp = angular.module('myApp', ['dx']);
myApp.controller("demoController", function ($scope) {
    $scope.tooltipVisible = false;
    $scope.toggleTooltip = function () {
        $scope.tooltipVisible = !$scope.tooltipVisible;
    },
    $scope.animationTypes = [
        "fade",
        "pop",
        "slide"
    ];
    $scope.animationConfig = {
        show: { type: "fade", from: 0, to: 1 },
        hide: { type: "fade", from: 1, to: 0 }
    };
    $scope.typeChanged = function (e) {
        switch (e.value) {
            case "slide":
                $scope.animationConfig = {
                    show: { type: "slide", from: { opacity: 1, top: -100 }, to: { top: 0 } },
                    hide: { type: "slide", from: { top: 0 }, to: { top: -100 } }
                };
                break;
            case "pop":
                $scope.animationConfig = {
                    show: { type: "pop", from: { opacity: 1, scale: 0 }, to: { scale: 1 } },
                    hide: { type: "pop", from: { scale: 1 }, to: { scale: 0 } }
                };
                break;
            case "fade":
                $scope.animationConfig = {
                    show: { type: "fade", from: 0, to: 1 },
                    hide: { type: "fade", from: 1, to: 0 }
                };
                break;
            default:
                $scope.animationConfig = {};
        }
    };
});
angular.element(document).ready(function () {
    angular.bootstrap(document, ['myApp']);
});
body {
    text-align: center;
}
.dx-button{
    margin-top: 25px;
}
<div id="button" data-bind="dxButton:{ text:'Hover over me' }, event: { mouseover: toggleTooltip, mouseout: toggleTooltip } "></div>
<div data-bind="dxTooltip:{
    target: '#button',
    visible: tooltipVisible,
    animation: animationConfig
}">
    <div data-options="dxTemplate:{ name: 'content' }">
        <p>This is a button.</p>
    </div>
</div>
<div class="dx-fieldset">
    <div class="dx-field">
        <div style="width: 60%" class="dx-field-label">Animation type</div>
        <div style="width: 40%" class="dx-field-value" data-bind="dxSelectBox: {
            items: animationTypes,
            value: 'fade',
            onValueChanged: typeChanged
        }"></div>
    </div>
</div>
var myViewModel = {
    tooltipVisible: ko.observable(false),
    toggleTooltip: function () {
        this.tooltipVisible(!this.tooltipVisible());
    },
    animationTypes: [
        "fade",
        "pop",
        "slide"
    ],
    animationConfig: ko.observable({
        show: { type: "fade", from: 0, to: 1 },
        hide: { type: "fade", from: 1, to: 0 }
    }),
    typeChanged: function (e) {
        switch (e.value) {
            case "slide":
                this.animationConfig({
                    show: { type: "slide", from: { opacity: 1, top: -100 }, to: { top: 0 } },
                    hide: { type: "slide", from: { top: 0 }, to: { top: -100 } }
                });
                break;
            case "pop":
                this.animationConfig({
                    show: { type: "pop", from: { opacity: 1, scale: 0 }, to: { scale: 1 } },
                    hide: { type: "pop", from: { scale: 1 }, to: { scale: 0 } }
                });
                break;
            case "fade":
                this.animationConfig({
                    show: { type: "fade", from: 0, to: 1 },
                    hide: { type: "fade", from: 1, to: 0 }
                });
                break;
            default:
                this.animationConfig({});
        }
    }
}
ko.applyBindings(myViewModel);
body {
    text-align: center;
}
.dx-button{
    margin-top: 25px;
}
<div id="button"></div>
<div id="myTooltip"></div>
<div class="dx-fieldset">
    <div class="dx-field">
        <div class="dx-field-label">Animation type</div>
        <div class="dx-field-value" id="animationSelector"></div>
    </div>
</div>
$("#myTooltip").dxTooltip({
    target: "#button",
    contentTemplate: function (contentElement) {
        contentElement.append("<p>This is a button.</p>");
    },
    animation: {
        show: { type: "fade", from: 0, to: 1 },
        hide: { type: "fade", from: 1, to: 0 }
    }
});
$("#button").dxButton({
    text: 'Hover over me'
});
$("#button").mouseover(function () {
    $("#myTooltip").dxTooltip("instance").show();
});
$("#button").mouseout(function () {
    $("#myTooltip").dxTooltip("instance").hide();
});
$("#animationSelector").dxSelectBox({
    items: [
        "fade",
        "pop",
        "slide"
    ],
    value: 'fade',
    onValueChanged: function (e) {
        switch (e.value) {
            case "slide":
                $("#myTooltip").dxTooltip("instance").option("animation", {
                    show: { type: "slide", from: { opacity: 1, top: -100 }, to: { top: 0 } },
                    hide: { type: "slide", from: { top: 0 }, to: { top: -100 } }
                });
                break;
            case "pop":
                $("#myTooltip").dxTooltip("instance").option("animation", {
                    show: { type: "pop", from: { opacity: 1, scale: 0 }, to: { scale: 1 } },
                    hide: { type: "pop", from: { scale: 1 }, to: { scale: 0 } }
                });
                break;
            case "fade":
                $("#myTooltip").dxTooltip("instance").option("animation", {
                    show: { type: "fade", from: 0, to: 1 },
                    hide: { type: "fade", from: 1, to: 0 }
                });
                break;
            default:
                $("#myTooltip").dxTooltip("instance").option("animation", {});
        }
    }
});
body {
    text-align: center;
}
.dx-button{
    margin-top: 25px;
}

closeOnBackButton

A Boolean value specifying whether or not the widget is closed if a user presses the Back hardware button.

Type: Boolean
Default Value: true

closeOnOutsideClick

A Boolean value specifying whether or not the widget is closed if a user clicks outside of the popover window and outside the target element.

Type: Boolean| function
Function parameters:
event: jQuery.Event
Holds the jQuery event that caused widget closing.
Return Value: Boolean
The required option value.
Default Value: true

The function passed to this option enables you to specify a custom condition for widget closing. For instance, you can prevent closing until a user clicks a certain element.

JavaScript
var widgetOptions = {
    // ...
    closeOnOutsideClick: function(e) {
        return e.target === $("#someElement").get()[0];
    }
}

contentTemplate

A template to be used for rendering widget content.

Type: String| function |DOM Node|jQuery
Function parameters:
contentElement: jQuery
The jQuery object of the widget content element.
Return Value: String|jQuery
A template name or a template container.
Default Value: 'content'

This option enables you to render widget contents depending on field values of the bound data model.

HTML
<div data-options="dxTemplate: { name:'myContent' }">
    <h1 data-bind="text: title"></h1>
    <p>Full name: <span data-bind="text: fullName"></span></p>
</div>

NOTE: A binding context of a content template is the bound view model. So, you can bind template elements to the view model's fields directly (see the code above). To access another binding context within a content template, use the Knockout/Angular binding variables.

Show Example:
AngularJS
Knockout
jQuery
<div ng-controller="demoController" style="height: 100%;">
    <div id="button" dx-button="{ text:'Hover over me' }" ng-mouseover="toggleTooltip()" ng-mouseout="toggleTooltip()"></div>
    <div dx-tooltip="{ 
        target: '#button',
        bindingOptions: {
            visible: 'tooltipVisible',
            contentTemplate: 'currentTemplate'
        }
    }">
        <div data-options="dxTemplate:{ name: 'brief' }">
            <p>This is a button.</p>
        </div>
        <div data-options="dxTemplate:{ name: 'full' }">
            <p>This is a button.</p>
            <p><i>It is a target widget for the current tooltip.</i></p>
        </div>
    </div>
    <div class="dx-fieldset">
        <div class="dx-field">
            <div class="dx-field-label" style="width:60%">contentTemplate</div>
            <div class="dx-field-value" style="width:40%" ng-model="currentTemplate" dx-select-box="{
                items: ['brief', 'full']
            }"></div>
        </div>
    </div>
</div>
var myApp = angular.module('myApp', ['dx']);
myApp.controller("demoController", function ($scope) {
    $scope.tooltipVisible = false;
    $scope.currentTemplate = 'brief';
    $scope.toggleTooltip = function () {
        $scope.tooltipVisible = !$scope.tooltipVisible;
    }
});
angular.element(document).ready(function () {
    angular.bootstrap(document, ['myApp']);
});
body {
    text-align: center;
}
.dx-button{
    margin-top: 25px;
}
<div id="button" data-bind="dxButton:{ text:'Hover over me' }, event: { mouseover: toggleTooltip, mouseout: toggleTooltip } "></div>
<div data-bind="dxTooltip:{
    target: '#button',
    visible: tooltipVisible,
    contentTemplate: currentTemplate
}">
    <div data-options="dxTemplate:{ name: 'brief' }">
        <p>This is a button.</p>
    </div>
    <div data-options="dxTemplate:{ name: 'full' }">
        <p>This is a button.</p>
        <p><i>It is a target widget for the current tooltip.</i></p>
    </div>
</div>
<div class="dx-fieldset">
    <div class="dx-field">
        <div class="dx-field-label" style="width:60%">contentTemplate</div>
        <div class="dx-field-value"  style="width:40%" data-bind="dxSelectBox: {
            items: ['brief', 'full'],
            value: currentTemplate
        }"></div>
    </div>
</div>
var myViewModel = {
    tooltipVisible: ko.observable(false),
    currentTemplate: ko.observable('brief'),
    toggleTooltip: function () {
        this.tooltipVisible(!this.tooltipVisible());
    }
}
ko.applyBindings(myViewModel);
body {
    text-align: center;
}
.dx-button{
    margin-top: 25px;
}
<div id="button"></div>
<div id="myTooltip"></div>
<div class="dx-fieldset">
    <div class="dx-field">
        <div class="dx-field-label" style="width:60%">contentTemplate</div>
        <div class="dx-field-value"  style="width:40%" id="templateSelector"></div>
    </div>
</div>
var briefTemplate = function (contentElement) {
    contentElement.append("<p>This is a button.</p>");
}
var fullTemplate = function (contentElement) {
    contentElement.append("<p>This is a button.</p>");
    contentElement.append("<p><i>It is a target widget for the current tooltip.</i></p>");
}
$("#myTooltip").dxTooltip({
    target: "#button",
    contentTemplate: briefTemplate
});
$("#button").dxButton({
    text: 'Hover over me'
});
$("#button").mouseover(function () {
    $("#myTooltip").dxTooltip("instance").show();
});
$("#button").mouseout(function () {
    $("#myTooltip").dxTooltip("instance").hide();
});
$("#templateSelector").dxSelectBox({
    items: ['brief', 'full'],
    value: 'brief',
    onValueChanged: function (e) {
        if(e.value === 'full')
            $("#myTooltip").dxTooltip("instance").option("contentTemplate", fullTemplate);
        else
            $("#myTooltip").dxTooltip("instance").option("contentTemplate", briefTemplate);
    }
});
body {
    text-align: center;
}
.dx-button{
    margin-top: 25px;
}

deferRendering

Specifies whether widget content is rendered when the widget is shown or when rendering the widget.

Type: Boolean
Default Value: true

If this option is set to true, widget content is rendered when showing the widget. Otherwise, widget content is rendered when rendering the widget.

disabled

A Boolean value specifying whether or not the widget can respond to user interaction.

Type: Boolean
Default Value: false

Create an observable variable and assign it to this option to specify the availability of the widget at runtime.

height

Specifies the height of the widget.

Type: Number|String| function
Return Value: Number|String
The widget height.
Default Value: 'auto'

The option can hold a value of the following types:

  • number
    The height of the widget in pixels

  • string
    A CSS measurement of the widget height (e.g., "55px", "80%", "auto" and "inherit")

  • function
    A function returning the widget height (e.g., height:function(){ return baseHeight - 10 + "%"; })

hint

Specifies the text of the hint displayed for the widget.

Type: String
Default Value: undefined

hoverStateEnabled

A Boolean value specifying whether or not the widget changes its state when being hovered by an end user.

Type: Boolean
Default Value: false

maxHeight

Specifies the maximum height the widget can reach while resizing.

Type: Number|String| function
Return Value: Number|String
The maximum height value.
Default Value: null

The option can hold a value of the following types.

  • numeric - the height in pixels
  • string - a CSS measurement of the height (e.g., "55px", "80%", "auto" and "inherit")
  • function - the function returning the height (e.g., width:function(){ return baseWidth - 10 + "%"; })

maxWidth

Specifies the maximum width the widget can reach while resizing.

Type: Number|String| function
Return Value: Number|String
The maximum width value.
Default Value: null

The option can hold a value of the following types.

  • numeric - the width in pixels
  • string - a CSS measurement of the width (e.g., "55px", "80%", "auto" and "inherit")
  • function - the function returning the width (e.g., width:function(){ return baseWidth - 10 + "%"; })

minHeight

Specifies the minimum height the widget can reach while resizing.

Type: Number|String| function
Return Value: Number|String
The minimum height value.
Default Value: null

The option can hold a value of the following types.

  • numeric - the height in pixels
  • string - a CSS measurement of the height (e.g., "55px", "80%", "auto" and "inherit")
  • function - the function returning the height (e.g., width:function(){ return baseWidth - 10 + "%"; })

minWidth

Specifies the minimum width the widget can reach while resizing.

Type: Number|String| function
Return Value: Number|String
The minimum width value.
Default Value: null

The option can hold a value of the following types.

  • numeric - the width in pixels
  • string - a CSS measurement of the width (e.g., "55px", "80%", "auto" and "inherit")
  • function - the function returning the width (e.g., width:function(){ return baseWidth - 10 + "%"; })

onContentReady

A handler for the contentReady event.

Type: function
Function parameters:
e: Object
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
element: jQuery
An HTML element of the widget.
model: Object
Provides access to the data that is available for binding against the element. Available only in the Knockout and AngularJS approaches.
Default Value: null

Assign a function to perform a custom action when widget content is ready.

onDisposing

A handler for the disposing event.

Type: function
Function parameters:
e: Object
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
element: jQuery
An HTML element of the widget.
model: Object
Provides access to the data that is available for binding against the element. Available only in the Knockout and AngularJS approaches.
Default Value: null

Assign a function to perform a custom action when the widget is being removed.

NOTE: The function assigned to this option is executed only if the widget is removed using the remove(), empty(), or html() jQuery methods.

onHidden

A handler for the hidden event.

Type: function
Function parameters:
e: Object
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
element: jQuery
An HTML element of the widget.
model: Object
Provides access to the data that is available for binding against the element. Available only in the Knockout and AngularJS approaches.
Default Value: null

Assign a function to perform a custom action after the widget is hidden.

onHiding

A handler for the hiding event.

Type: function
Function parameters:
e: Object
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
element: jQuery
An HTML element of the widget.
model: Object
Provides access to the data that is available for binding against the element. Available only in the Knockout and AngularJS approaches.
cancel: Boolean
Indicates whether to cancel hiding the overlay.
Default Value: null

Assign a function to perform a custom action before hiding the widget.

onInitialized

A handler for the initialized event.

Type: function
Function parameters:
e: Object
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
element: jQuery
An HTML element of the widget.
Default Value: null

Assign a function to perform a custom action when the widget is initialized.

onOptionChanged

A handler for the optionChanged event.

Type: function
Function parameters:
e: Object
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
name: String
Specifies the name of the option whose value is changed.
fullName: String
Specifies a full name of the option whose value is changed. The full name is formed by concatenating the names of the options that are presented in the hierarchy of the given option. The names are delimited by commas.
value: any
Specifies a new value for the option.
element: jQuery
An HTML element of the widget.
model: Object
Provides access to the data that is available for binding against the element. Available only in the Knockout and AngularJS approaches.
Default Value: null

Assign a function to perform a custom action after an option of the component is changed.

onResize

A handler for the resize event.

Type: function
Function parameters:
e: Object
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
element: jQuery
An HTML element of the widget.
model: Object
Provides access to the data that is available for binding against the element. Available only in the Knockout and AngularJS approaches.
Default Value: null

Assign a function to perform a custom action each time the widget is resized by one pixel.

onResizeEnd

A handler for the resizeEnd event.

Type: function
Function parameters:
e: Object
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
element: jQuery
An HTML element of the widget.
model: Object
Provides access to the data that is available for binding against the element. Available only in the Knockout and AngularJS approaches.
Default Value: null

Assign a function to perform a custom action after resizing has been finished.

onResizeStart

A handler for the resizeStart event.

Type: function
Function parameters:
e: Object
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
element: jQuery
An HTML element of the widget.
model: Object
Provides access to the data that is available for binding against the element. Available only in the Knockout and AngularJS approaches.
Default Value: null

Assign a function to perform a custom action after resizing has been started.

onShowing

A handler for the showing event.

Type: function
Function parameters:
e: Object
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
element: jQuery
An HTML element of the widget.
model: Object
Provides access to the data that is available for binding against the element. Available only in the Knockout and AngularJS approaches.
Default Value: null

Assign a function to perform a custom action before showing the widget.

onShown

A handler for the shown event.

Type: function
Function parameters:
e: Object
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
element: jQuery
An HTML element of the widget.
model: Object
Provides access to the data that is available for binding against the element. Available only in the Knockout and AngularJS approaches.
Default Value: null

Assign a function to perform a custom action after the widget is shown.

position

An object defining widget positioning options.

Default Value: 'bottom'
Accepted Values: 'top' | 'bottom' | 'left' | 'right'

Besides the position configuration object, the option can take on the following string values, which are shortcuts for the corresponding position configuration.

  • 'top' - places the popover over the target element
  • 'bottom' - places the popover under the target element
  • 'left' - places the popover to the left of the target element
  • 'right' - places the popover to the right of the target element
Show Example:
AngularJS
Knockout
jQuery
<div ng-controller="demoController" style="height: 100%;">
    <div id="button" dx-button="{ text:'Button' }" ng-mouseover="toggleTooltip()" ng-mouseout="toggleTooltip()"></div>
    <div dx-tooltip="{ 
        target: '#button',
        bindingOptions: {
            visible: 'tooltipVisible',
            position: 'currentPosition'
        }
    }">
        <div data-options="dxTemplate:{ name: 'content' }">
            <p>Button</p>
        </div>
    </div>
    <div class="dx-fieldset">
        <div class="dx-field">
            <div class="dx-field-label">position</div>
            <div class="dx-field-value" ng-model="currentPosition" dx-select-box="{
                items: ['top', 'bottom', 'left', 'right']
            }"></div>
        </div>
    </div>
</div>
var myApp = angular.module('myApp', ['dx']);
myApp.controller("demoController", function ($scope) {
    $scope.tooltipVisible = false;
    $scope.currentPosition = 'bottom',
    $scope.toggleTooltip = function () {
        $scope.tooltipVisible = !$scope.tooltipVisible;
    }
});
angular.element(document).ready(function () {
    angular.bootstrap(document, ['myApp']);
});
body {
    text-align: center;
}
.dx-button{
    margin-top: 80px;
}
<div id="button" data-bind="dxButton:{ text:'Button' }, event: { mouseover: toggleTooltip, mouseout: toggleTooltip } "></div>
<div data-bind="dxTooltip:{
    target: '#button',
    visible: tooltipVisible,
    position: currentPosition
}">
    <div data-options="dxTemplate:{ name: 'content' }">
        <p>Button</p>
    </div>
</div>
<div class="dx-fieldset">
    <div class="dx-field">
        <div class="dx-field-label">position</div>
        <div class="dx-field-value" data-bind="dxSelectBox: {
            items: ['top', 'bottom', 'left', 'right'],
            value: currentPosition
        }"></div>
    </div>
</div>
var myViewModel = {
    tooltipVisible: ko.observable(false),
    currentPosition: ko.observable('bottom'),
    toggleTooltip: function () {
        this.tooltipVisible(!this.tooltipVisible());
    }
}
ko.applyBindings(myViewModel);
body {
    text-align: center;
}
.dx-button{
    margin-top: 80px;
}
<div id="button"></div>
<div id="myTooltip"></div>
<div class="dx-fieldset">
    <div class="dx-field">
        <div class="dx-field-label">position</div>
        <div class="dx-field-value" id="positionSelector"></div>
    </div>
</div>
$("#myTooltip").dxTooltip({
    target: "#button",
    position: 'bottom',
    contentTemplate: function (contentElement) {
        contentElement.append("<p>Button</p>");
    }
});
$("#button").dxButton({
    text: 'Button'
});
$("#button").mouseover(function () {
    $("#myTooltip").dxTooltip("instance").show();
});
$("#button").mouseout(function () {
    $("#myTooltip").dxTooltip("instance").hide();
});
$("#positionSelector").dxSelectBox({
    items: ['top', 'bottom', 'left', 'right'],
    value: 'bottom',
    onValueChanged: function (e) {
        $("#myTooltip").dxTooltip("instance").option("position", e.value);
    }
});
body {
    text-align: center;
}
.dx-button{
    margin-top: 80px;
}

rtlEnabled

Specifies whether or not the current component supports a right-to-left representation.

Type: Boolean
Default Value: false

If you need to switch the display of this DevExtreme component to right-to-left, enable a specifically designed configuration option - rtlEnabled. When this option is set to true, the text flows from right to left, and the layout the component's elements is reversed. To switch the entire application/site to a right-to-left representation, use the static DevExpress.rtlEnabled field.

shading

A Boolean value specifying whether or not the main screen is inactive while the widget is active.

Type: Boolean
Default Value: false

Show Example:
AngularJS
Knockout
jQuery
<div ng-controller="demoController" style="height: 100%;">
    <div id="button" dx-button="{ text:'Hover over me' }" ng-mouseover="showTooltip()"></div>
    <div dx-tooltip="{ 
        target: '#button',
        bindingOptions: {
            visible: 'tooltipVisible',
            shading: 'shadeScreen'
        }
    }">
        <div data-options="dxTemplate:{ name: 'content' }">
            <p>Click outside to close.</p>
        </div>
    </div>
    <div class="dx-fieldset">
        <div class="dx-field">
            <div class="dx-field-label">shading</div>
            <div class="dx-field-value" ng-model="shadeScreen" dx-switch="{ }"></div>
        </div>
    </div>
</div>
var myApp = angular.module('myApp', ['dx']);
myApp.controller("demoController", function ($scope) {
    $scope.tooltipVisible = false;
    $scope.shadeScreen = false;
    $scope.showTooltip = function () {
        $scope.tooltipVisible = true;
    }
});
angular.element(document).ready(function () {
    angular.bootstrap(document, ['myApp']);
});
body {
    text-align: center;
}
.dx-button{
    margin-top: 25px;
}
<div id="button" data-bind="dxButton:{ text:'Hover over me' }, event: { mouseover: showTooltip } "></div>
<div data-bind="dxTooltip:{
    target: '#button',
    visible: tooltipVisible,
    showCloseButton: true,
    shading: shadeScreen
}">
    <div data-options="dxTemplate:{ name: 'content' }">
        <p>Click outside to close.</p>
    </div>
</div>
<div class="dx-fieldset">
    <div class="dx-field">
        <div class="dx-field-label">shading</div>
        <div class="dx-field-value" data-bind="dxSwitch:{ 
            value: shadeScreen
        }"></div>
    </div>
</div>
var myViewModel = {
    tooltipVisible: ko.observable(false),
    shadeScreen: ko.observable(false),
    showTooltip: function () {
        this.tooltipVisible(true);
    }
}
ko.applyBindings(myViewModel);
body {
    text-align: center;
}
.dx-button{
    margin-top: 25px;
}
<div id="button"></div>
<div id="myTooltip"></div>
<div class="dx-fieldset">
    <div class="dx-field">
        <div class="dx-field-label">shading</div>
        <div class="dx-field-value" id="shadingSelector"></div>
    </div>
</div>
$("#myTooltip").dxTooltip({
    target: "#button",
    contentTemplate: function (contentElement) {
        contentElement.append("<p>Click outside to close.</p>");
    }
});
$("#button").dxButton({
    text: 'Hover over me'
});
$("#button").mouseover(function () {
    $("#myTooltip").dxTooltip("instance").show();
});
$("#shadingSelector").dxSwitch({
    value: false,
    onValueChanged: function (e) {
        $("#myTooltip").dxTooltip("instance").option("shading", e.value);
    }
});
body {
    text-align: center;
}
.dx-button{
    margin-top: 25px;
}

shadingColor

Specifies the shading color.

Type: String
Default Value: ''

This option makes sense only if the shading option is set to true.

target

The target element associated with a popover.

Specify this option to indicate the element for which the popover will be invoked. This option can take on one of the following values.

JavaScript
//CSS selector
target: '#targetElement';

//jQuery wrapper
target: $('#targetElement');

//DOM element
target: document.getElementById('targetElement');

To align the popover near this element, use the position option.

visible

A Boolean value specifying whether or not the widget is visible.

Type: Boolean
Default Value: false

You can show and hide the widget by changing the value of an observable variable passed to this option.

width

Specifies the width of the widget.

Type: Number|String| function
Return Value: Number|String
The widget width.
Default Value: 'auto'

The option can hold a value of the following types.

  • numeric - the widget width in pixels
  • string - a CSS measurement of the widget width (e.g., "55px", "80%", "auto" and "inherit")
  • function - the function returning the widget width (e.g., width:function(){ return baseWidth - 10 + "%"; })