# MediaQuery Overview

The <a href = "https://www.telerik.com/blazor-ui/mediaquery" target="_blank">MediaQuery component for Blazor</a> allows you to react when the user changes the size of the browser.

## Creating Blazor MediaQuery

> caption To use the TelerikMediaQuery on your page:

1. Add the `<TelerikMediaQuery>` tag to your razor page.
2. Set the `Media` parameter to a <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_media_queries" target="_blank">CSS media query</a> to be matched. Use one component instance for each media query.
3. Use the `OnChange` event to determine when the `Media` is matched.

<demo metaUrl="client/mediaquery/overview/example-1/" height="620"></demo>

## MediaQuery Parameters

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

| Parameter  | Type                  | Description                                                                                                                                                                                                                                                                                                |
| ---------- | --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Media`    | `string`              | The <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_media_queries" target="_blank">media query string</a> that will be matched.                                                                                                                                              |
| `OnChange` | `EventCallback<bool>` | This event indicates whether the media query string provided to the `Media` parameter matches the current browser size. It fires when it matches, and when it stops matching. See the [Events](https://www.telerik.com/blazor-ui/documentation/components/mediaquery/events) article for more information. |

## Notes

The MediaQuery component facilitates the usage of CSS media queries in your C# code:

* The MediaQuery component makes it easy to use C# logic based on the matched media query breakpoints. For example, you can change parameter values, replace a component with a different component or even not render parts of the layout. With CSS alone you can resize parts of the app or hide them visually, but they still render.
* The MediaQuery component is not designed as a full replacement for responsive design, layout and CSS. You should use them to create your responsive application layouts like with any other web application.

## Next Steps

* [Explore the MediaQuery events](https://www.telerik.com/blazor-ui/documentation/components/mediaquery/events)
* [Integrate the MediaQuery with other Telerik Blazor components](https://www.telerik.com/blazor-ui/documentation/components/mediaquery/integration)

## See Also

* [Live Demo: MediaQuery](https://demos.telerik.com/blazor-ui/mediaquery/overview)
* [Live Demo: MediaQuery - Grid Integration](https://demos.telerik.com/blazor-ui/mediaquery/grid-integration)
* [MediaQuery API Reference](https://www.telerik.com/blazor-ui/documentation/api/telerik.blazor.components.telerikmediaquery)
