Access current MudBlazor breakpoint in code

I want to be able to set a property of a MudBlazor Date Picker component based on breakpoint. I can only think of having 2 versions and hiding one or the other but I am hoping there is a cleaner way.

And more generally is there an easy way to detect in the @code section what breakpoint the user is in?


Solution 1:

You can use IBreakpointService

here is an example of changing the DateTime picker value by changing the breakpoint.

https://try.mudblazor.com/snippet/GkwcklvshoBJfwUS