# TelerikRootComponent Overview

The `TelerikRootComponent` is a special component in Telerik UI for Blazor. Its placement and configuration affects all other Telerik Blazor components. This article describes the purpose and usage of `TelerikRootComponent`.

## Purpose

The `TelerikRootComponent` is responsible for the following tasks:

* It provides settings to all its child Telerik components, for example, for the [icon type](https://www.telerik.com/blazor-ui/documentation/common-features/icons#set-global-blazor-icon-type) or [right-to-left (RTL) support](https://www.telerik.com/blazor-ui/documentation/globalization/rtl-support).
* It renders all Telerik popups, which has the following benefits:
  * It's more reliable that the popups will display on top of the other page content.
  * There is no risk for the popups to be trapped by scrollable containers, or clipped by containers with an `overflow:hidden` style.
* It exposes the `DialogFactory` for using [predefined dialogs](https://www.telerik.com/blazor-ui/documentation/components/dialog/predefined).
* It helps with the integration of components, for example, when using [connected ListBoxes](https://www.telerik.com/blazor-ui/documentation/components/listbox/connect) or a [Chart Breadcrumb](https://www.telerik.com/blazor-ui/documentation/components/chart/drilldown#).

The `TelerikRootComponent` achieves all these tasks with the help of [cascading values](https://learn.microsoft.com/en-us/aspnet/core/blazor/components/cascading-values-and-parameters). That's why it is crucial for the Root Component to wrap all other Telerik components in the app, otherwise an [exception may occur](https://www.telerik.com/blazor-ui/documentation/knowledge-base/common-component-requires-telerikrootcomponent). To ensure correct popup position, it is also highly recommended for the `TelerikRootComponent` to be the top-level component in the app and wrap all other content, including the application layout.

## Using TelerikRootComponent

This section applies to:

* .NET 8 and .NET 9 Blazor Web Apps with **Global** interactivity location. If your app has **Per page/component** interactivity, then refer to section [Interactivity Considerations](https://www.telerik.com/blazor-ui/documentation/components/rootcomponent/overview#interactivity-considerations) below.
* Blazor Server, WebAssembly and Hybrid apps in all .NET versions

The recommended way to add `TelerikRootComponent` to a Blazor app is to:

1. Create a new layout file in the app, for example, `TelerikLayout.razor`.
2. Place the new layout in the same folder as the default application layout `MainLayout.razor`.
3. Add a `<TelerikRootComponent>` tag to the new layout and set `@Body` as the root component's child content.
4. Make the new layout a parent of the default application layout.

> caption Adding TelerikRootComponent to a new layout

```RAZOR.skip-repl TelerikLayout.razor
@inherits LayoutComponentBase

<TelerikRootComponent>
    @Body
</TelerikRootComponent>
```

```RAZOR MainLayout.razor
@inherits LayoutComponentBase
@layout TelerikLayout

@* The other MainLayout.razor content remains the same. *@
```

The above approach has the following benefits:

* There is a separation of concerns and a single `TelerikRootComponent` can be a parent of multiple other layouts.
* You can use `DialogFactory` (predefined Telerik dialogs) in `MainLayout.razor`.

However, you can also add `<TelerikRootComponent>` directly to an existing application layout, instead of creating a new one.

> caption Adding TelerikRootComponent to MainLayout.razor

```RAZOR.skip-repl
@inherits LayoutComponentBase

<TelerikRootComponent>
    @* All the MainLayout.razor content becomes nested in the Telerik root component. *@
</TelerikRootComponent>
```

## Interactivity Considerations

.NET 8 introduced new [render modes for Blazor web apps](https://learn.microsoft.com/en-us/aspnet/core/blazor/components/render-modes) and the concept of static Blazor apps with optional interactive components. The following requirements and considerations apply to the `TelerikRootComponent`:

* The `TelerikRootComponent` must reside in an interactive layout or component.
* Application layouts are interactive only if the whole app is interactive. To achieve this, set **Interactivity location** of the app to **Global** during app creation.

If you are using Telerik components in a Blazor app with **Per page/component** interactivity location, then learn [how to correctly add the `TelerikRootComponent`](https://www.telerik.com/blazor-ui/documentation/components/rootcomponent/per-component-interactivity-location) in this case.

## TelerikRootComponent Parameters

<style>
    .article table {
        table-layout: auto;
        word-break: normal;
    }
</style>

| Parameter   | Type and Default Value                            | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ----------- | ------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `EnableRtl` | `bool`                                            | Enables [right-to-left (RTL) support](https://www.telerik.com/blazor-ui/documentation/globalization/rtl-support).                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `IconType`  | `IconType` enum <br /> (`Svg`)                    | The icon type, which other Telerik components will use to render internal icons. Regardless of this parameter value, you can freely use the [`<TelerikFontIcon>`](https://www.telerik.com/blazor-ui/documentation/common-features/icons#fonticon-component) and [`<TelerikSvgIcon>`](https://www.telerik.com/blazor-ui/documentation/common-features/icons#svgicon-component) components, and [set the `Icon` parameter of other Telerik components](https://www.telerik.com/blazor-ui/documentation/components/button/icons) to any type that you wish. |
| `Localizer` | `Telerik.Blazor.Services.ITelerikStringLocalizer` | The Telerik localization service. The recommended approach is to [define the localizer as a service in `Program.cs`](https://www.telerik.com/blazor-ui/documentation/globalization/localization). Use the `Localizer` parameter only in special cases when this is not possible.                                                                                                                                                                                                                                                                         |

### TelerikRootComponent Settings

The `TelerikRootComponent` exposes and additional `<RootComponentSettings>` tag for further customizations. You can use it to configure the screen breakpoints for the adaptive rendering of the supported components. [Learn how to customize the default adaptive breakpoints](https://www.telerik.com/blazor-ui/documentation/common-features/adaptive-rendering#customize-the-default-adaptive-breakpoints).

## See Also

* [Popup Troubleshooting](https://www.telerik.com/blazor-ui/documentation/troubleshooting/general-issues)
* [Setting up Telerik Blazor apps](https://www.telerik.com/blazor-ui/documentation/getting-started/workflow-details)
* [Exception: Telerik component requires a TelerikRootComponent](https://www.telerik.com/blazor-ui/documentation/knowledge-base/common-component-requires-telerikrootcomponent)
