BlazorSize icon indicating copy to clipboard operation
BlazorSize copied to clipboard

MediaQuery for component instead of whole screen size

Open tostein opened this issue 3 years ago • 4 comments

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?

tostein avatar Feb 14 '22 14:02 tostein

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.

EdCharbeneau avatar Feb 14 '22 15:02 EdCharbeneau

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.

tostein avatar Feb 14 '22 22:02 tostein