Averigua qué tamaño de pantalla tiene tu usuario y deja que tu código reaccione cuando cambia.
Por qué ayuda
- Puntos de ruptura con nombre
- Se actualiza al redimensionar
- Sencillo
Dónde encaja
- Lógica adaptable
- Cambios de diseño
- Menús
Ejemplo
<BreakpointObserver>
<p>Current breakpoint: <strong>@context</strong> (resize the window to see it change).</p>
@if (context >= Breakpoint.Lg)
{
<Alert Severity="Severity.Info">Wide layout: the sidebar is shown.</Alert>
}
else
{
<Alert Severity="Severity.Warning">Narrow layout: the sidebar is hidden.</Alert>
}
</BreakpointObserver> Un breve fragmento. Añade @using RayCraft.Blazor.Components a tu página y usa un modo de renderizado interactivo.
Incluido en RayCraft Free. Hay ejemplos que funcionan en el repositorio de GitHub (MIT); contiene código de ejemplo y demostración, no el código de la biblioteca.