I want to figure out what size the screen is/if it is less than size xs/sm and if so, don't display some components. Is there a property that gives access to this value?
There isn't such property.
Any reason why not? Is it something that could be added? Feels like a reasonable thing to be able to key off of for different layouts.
Such feature was never requested before nor weโve received such pull requests, still we are open!
OK, I took a look before and it wasn't clear to me where in RadzenColumn.razor.cs it was making that determination. I searched for instances of various keywords from those sizes as well as the breakpoint values and didn't see anything obvious.
If I were to just do this on my own, I'd probably want to put it in some sort of utility class and utilize the JsRuntime.
Should this go in common.cs?
We have RadzenMediaQuery which is used in some components: radzen-blazor/Radzen.Blazor/RadzenSidebar.razor at master ยท radzenhq/radzen-blazor ยท GitHub
You can specify the target breakpoints as in this demo and handle the Change event.
If you just want to get the width of the browser you can try something like:
var width = await jsRuntime.InvokeAsync<int>("eval", "'window.innerWidth'");