<commit_before>---
layout: default
title: delite/Scrollable
---

# delite/Scrollable

`delite/Scrollable` is a `delite/Widget` subclass which adds to the widget
scrolling capabilities based on the [`overflow: auto`](http://www.w3.org/TR/CSS2/visufx.html#overflow) 
CSS property.

By default, the scrolling capabilities are added to the widget's root node
(that is, the widget itself). The host widget can chose the node thanks to the property
`scrollableNode`. This property must be set by the subclass at latest in its `buildRendering()`
method.

##### Table of Contents
[Extending Scrollable](#extending)
[Using Scrollable](#using)
[Element Styling](#styling)
[User Interactions](#interactions)
[Events](#events)
[Enterprise Use](#enterprise)

<a name="extending"></a>
## Extending Scrollable

First use-case: creating a widget extending `delite/Scrollable`

```js
define(["delite/register", "delite/Scrollable", ...],
  function (register, Scrollable, ...) {
    return register("mywidget", [HTMLElement, Scrollable, ...], {
      ...
      buildRendering: dcl.superCall(function (sup) {
        return function () {
          // Create a child element:
          var myScrollableDiv = document.createElement("div");
          ...
          this.appendChild(myScrollableDiv);
          // Indicate the scrollable child element:
          this.scrollableNode = myScrollableDiv; 
          sup.apply(this, arguments);
        };<commit_msg>Fix TOC end of lines<commit_after>---
layout: default
title: delite/Scrollable
---

# delite/Scrollable

`delite/Scrollable` is a `delite/Widget` subclass which adds to the widget
scrolling capabilities based on the [`overflow: auto`](http://www.w3.org/TR/CSS2/visufx.html#overflow) 
CSS property.

By default, the scrolling capabilities are added to the widget's root node
(that is, the widget itself). The host widget can chose the node thanks to the property
`scrollableNode`. This property must be set by the subclass at latest in its `buildRendering()`
method.

##### Table of Contents
[Extending Scrollable](#extending)  
[Using Scrollable](#using)  
[Element Styling](#styling)  
[User Interactions](#interactions)  
[Events](#events)  
[Enterprise Use](#enterprise)

<a name="extending"></a>
## Extending Scrollable

First use-case: creating a widget extending `delite/Scrollable`

```js
define(["delite/register", "delite/Scrollable", ...],
  function (register, Scrollable, ...) {
    return register("mywidget", [HTMLElement, Scrollable, ...], {
      ...
      buildRendering: dcl.superCall(function (sup) {
        return function () {
          // Create a child element:
          var myScrollableDiv = document.createElement("div");
          ...
          this.appendChild(myScrollableDiv);
          // Indicate the scrollable child element:
          this.scrollableNode = myScrollableDiv; 
          sup.apply(this, arguments);
        };
{'fraction_non_alphanumeric': 0.12625043118316662, 'fraction_numerical': 0.0013797861331493618, 'mean_word_length': 3.6104928457869634, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5959374', 'n_tokens_mistral': 849, 'n_tokens_neox': 812, 'n_words': 254}