GuideUpdated in v15

Mobile & responsive

Make ngwr layouts work on touch screens and narrow containers.

Adaptive layout components

Add responsive to reflow on the component's own width, not the viewport.

<wr-descriptions responsive inline bordered>…</wr-descriptions>
<wr-stepper responsive>…</wr-stepper>
<wr-page-header responsive title="Settings">…</wr-page-header>
<wr-toolbar responsive>…</wr-toolbar>
<wr-pagination responsive [(page)]="page" [total]="200" />
<wr-table responsive [columns]="cols" [items]="rows" />
ComponentWhen narrow
wr-descriptionsColumns stack.
wr-stepperTurns vertical.
wr-page-headerActions move below the title.
wr-toolbarWraps.
wr-paginationCollapses to current / total.
wr-tableRows become labelled cards.
wr-tabsScrolls with an edge fade. No flag needed.

Touch targets

Small controls grow their hit area on touch screens; mouse layouts do not change.

Touch density

touch enlarges padding on density-aware controls; checkbox, switch, radio, segmented and slider keep their size.

import { provideWr } from 'ngwr';
import { withDensity } from 'ngwr/density';

// App-wide: sm | md | lg | touch
provideWr(withDensity({ defaultDensity: 'touch' }));

// One subtree: <section wrDensity="touch">…</section>

Swipe gestures

Built in, no input needed.

  • Lightbox: swipe down to close.
  • Toast: swipe sideways to dismiss.
  • Carousel: swipe left or right to change slides.

Safe areas

Toast and back-top clear notches and home indicators by themselves. A drawer opts in with safeArea.

<wr-drawer position="bottom" safeArea>…</wr-drawer>

Build your own

Use media-up / media-down from ngwr/breakpoints in SCSS, and the CDK's BreakpointObserver in TypeScript.

@use 'ngwr/breakpoints' as bp;

.toolbar {
  flex-direction: column;

  @include bp.media-up(md) {
    flex-direction: row;
  }
}

On the server there is no viewport

Breakpoint queries are false on the server, so prefer responsive to a template branch (SSR guide).

See also