# ASP.NET Core TileLayout Overview

The Telerik UI TileLayout TagHelper and HtmlHelper for ASP.NET Core are server-side wrappers for the Kendo UI TileLayout widget.

The TileLayout widget allows you to configure a two-dimensional grid-based sandbox surface to display content in tiles which can be dragged around and rearranged to create any modern page design.

The component is based on the [CSS Grid](https://css-tricks.com/snippets/css/complete-guide-grid/) (with all its features) which covers the majority of cases and uses additional JavaScript logic to provide resizing, reordering, and templates customizations.

* [Demo page for the TileLayout HtmlHelper](https://demos.telerik.com/aspnet-core/tilelayout/index)

* [Demo page for the TileLayout TagHelper](https://demos.telerik.com/aspnet-core/tilelayout/tag-helper)

## Initializing the TileLayout

To initialize the TileLayout, specify the number of [`Columns()`](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/tilelayoutbuilder#columnssystemdouble) at root level and use the [`RowSpan()`](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/tilelayoutcontainerbuilder#rowspansystemdouble) and [`ColSpan()`](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/tilelayoutcontainerbuilder#colspansystemdouble) of the containers to position the content in the available grid space.

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

```Razor HtmlHelper
    @(Html.Kendo().TileLayout()
        .Name("tilelayout")
        .Columns(2)
        .RowsHeight("285px")
        .ColumnsWidth("285px")
        .Containers(c => {
            c.Add().Header(h => h.Text("Header One")).BodyTemplate("Body Text One").ColSpan(1).RowSpan(1);
            c.Add().Header(h => h.Text("Header Two")).BodyTemplate("Body Text Two").ColSpan(1).RowSpan(1);
            c.Add().Header(h => h.Text("Header Three")).BodyTemplate("Body Text Three").ColSpan(2).RowSpan(1);
        })
        .Reorderable(true)
        .Resizable(true)
    )
```

```Razor TagHelper
        <kendo-tilelayout name="tilelayout" columns="2" resizable="true" reorderable="true" columns-width="300px" rows-height="300px">
            <containers>
                <container body-template="Template One" col-span="1" row-span="1">
                    <container-header text="One" />
                </container>
                <container body-template="Template Two" col-span="1" row-span="1">
                    <container-header text="Two" />
                </container>
                <container body-template="Template Three" col-span="2" row-span="1">
                    <container-header text="Three" />
                </container>
            </containers>
        </kendo-tilelayout>
```

## Grid Layout Configuration

The Telerik UI TileLayout for ASP.NET Core available grid space is defined by using the [`Columns()`](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/tilelayoutbuilder#columnssystemdouble) method. The number of rows in which the tiles will be displayed will automatically adjust. The columns and rows have a default width of `1fr` which can be modified by using the [`ColumnsWidth()`](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/tilelayoutbuilder#columnswidthsystemstring) and [`RowsHeight()`](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/tilelayoutbuilder#rowsheightsystemstring) methods.

> The `RowsHeight()` and `ColumnsWidth()` methods parameter value sets the maximum height/width the rows or columns of the widget will stretch to. Dependent on resizing, content and user interactions with the layout, they may be less than the set value.

## Tile Layout Configuration

Each tile can fit within multiple rows and columns. The space that the tile takes up is determined by its container's [`RowSpan()`](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/tilelayoutcontainerbuilder#rowspansystemdouble) and [`ColSpan()`](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/tilelayoutcontainerbuilder#colspansystemdouble). For more information about the containers and their configurable properties, see the [containers](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/layout/tilelayout/containers) article.

## Gaps

The grid lines between the rows and columns can be configured by specifying the [`Gap.Columns`](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/tilelayoutgapsettingsbuilder#columnssystemdouble) for the vertical space between the tiles and the [`Gap.Rows`](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/tilelayoutgapsettingsbuilder#rowssystemdouble) for the horizontal spacing.

```Razor HtmlHelper
    .Gap(g=>g.Columns(10).Rows(10))
```

```Razor TagHelper
    <kendo-tilelayout name="tilelayout" columns="2" resizable="true" reorderable="true" columns-width="300px" rows-height="300px">
            <gap rows="10" columns="10" />
```

These properties are also known as the gutters between the rows/columns.

## Functionality and Features

| Feature                                                                                                                                      | Description                                                                    |
| -------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ |
| [Reordering](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/layout/tilelayout/reordering)                                 | You can enable the reordering feature to drag and drop the tile containers.    |
| [Resizing](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/layout/tilelayout/resizing)                                     | The TileLayout allows you to resize its containers.                            |
| [Containers](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/layout/tilelayout/containers)                                 | You can specify the appearance of the containers.                              |
| [Add or Remove Tiles](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/layout/tilelayout/add-remove)                        | You can add or remove tiles dynamically.                                       |
| [Events](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/layout/tilelayout/events)                                         | The TileLayout allows you to handle its events and implement any custom logic. |
| [Keyboard Navigation](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/layout/tilelayout/accessibility/keyboard-navigation) | The component delivers keyboard shortcuts for faster navigation.               |

## Known Limitations

Currently, the component is not supported in Internet Explorer as the browser does not support gutters.

## Next Steps

* [Getting Started with the TileLayout](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/layout/tilelayout/getting-started)
* [Basic Usage of the TileLayout for ASP.NET Core (Demo)](https://demos.telerik.com/aspnet-core/tilelayout/index)

## See Also

* [Using the Events of the TileLayout for ASP.NET Core (Demo)](https://demos.telerik.com/aspnet-core/tilelayout/events)
* [Knowledge Base Section](https://www.telerik.com/aspnet-core-ui/documentation/knowledge-base)
