BlazorSize
BlazorSize copied to clipboard
MediaQuery for component instead of whole screen size
It would be nice to have a MediaQuery component which does not use the whole screen width to match but only a specific component width which i can relate to with an ID property.
Something like <MediaQuery Media="@Breakpoints.OnlyMedium" ID="my-div" @bind-Matches="IsMedium" />
Would that be an interesting feature request?
It's a great idea, however there's no native support for this in the browser. The reason BlazorSize is possible is because the browser has an API called matchMedia which provides events and data for screen size changes.
You're right. It is already great to have these events available for Blazor.
Maybe at some point in time the @container queries are established and supported by the browsers: https://github.com/w3c/csswg-drafts/issues/5796.