# TileLayout Resizing

The Telerik UI TileLayout for ASP.NET Core allows you resize the containers by snapping to the available columns and row units. When enabled the user is able to alter the width or the height of a current item.

The resizing takes advantage of the [CSS Grid](https://css-tricks.com/snippets/css/complete-guide-grid/) mechanism, meaning that the widget increases how the element spans and the browser takes care of how to re-arrange the items if necessary.

## Enabling the Resizable Feature of the TileLayout

To enable the resizable feature of the TileLayout, set the [`Resizable()`](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/tilelayoutbuilder#resizable) method . When resizable is enabled, the TileLayout items should have `RowSpan` and `ColSpan` defined.

The example below will render a grid with two rows and two columns which can be resized both vertically and horizontally.

```Razor HtmlHelper
     @(Html.Kendo().TileLayout()
        .Name("tilelayout")
        .Columns(3)
        .Containers(c => {
            c.Add().Header(h => h.Text("Item one")).BodyTemplate("Item one body").ColSpan(1).RowSpan(1);
            c.Add().Header(h => h.Text("Item two")).BodyTemplate("Item two body").ColSpan(1).RowSpan(1);
        })
        .Resizable(true)
    )
```

```Razor TagHelper
    <kendo-tilelayout columns="3" resizable="true" name="tilelayout" on-resize="onTileResize">
        <containers>
            <container body-template="Item one body" col-span="1" row-span="1">
                <container-header text="Item one"/>
            </container>
            <container body-template="Item two body" col-span="1" row-span="1">
                <container-header text="Item two"/>
            </container>
        </containers>
    </kendo-tilelayout>
```

## Event Handling

The component triggers the [`Resize`](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/tilelayouteventbuilder#resizesystemstring) event, which provides access to the resized container.

```Razor HtmlHelper
    .Events(e=>e.Resize("onResize"))
    <script>
        function onResize (e) {
            console.log(e.container.find(".k-card-header").text());
        }
    </script>
```

```Razor TagHelper
    <kendo-tilelayout name="tilelayout" on-resize="onResize">
    </kendo-tilelayout>

    <script>
        function onResize(e) {
            console.log(e.container.find(".k-card-header").text());
        }
    </script>
```

## See Also

* [Overview of the TileLayout (Demo)](https://demos.telerik.com/aspnet-core/tilelayout/index)
* [API Reference of the TileLayout](https://www.telerik.com/aspnet-core-ui/documentation/api/tilelayout)
* [Reordering](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/layout/tilelayout/reordering)
* [Containers](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/layout/tilelayout/containers)
