skip to content

Angular Material & CDK

2 roadmaps66 questionsupdated

Angular's own kit: Material 3 components and theming, built on the CDK's overlays, virtual scrolling, drag and drop and a11y tools. Interviewers ask when the kit fits and when the primitives fit.

on this pageshow

guide

overview

~1 min

Angular Material is the Angular team's own component kit: Material 3 components and a Sass theming API, built on the **Component Dev Kit (CDK)**, a set of unstyled behaviour primitives (overlays, virtual scrolling, drag and drop, focus management) that you can also use without Material at all. Interviewers come at it from two sides. As a product: can you theme, feed, test and upgrade a component the supported way? As a platform: do you know the layer underneath well enough to build a widget Material does not ship, and to say when the finished kit fits and when the primitives do? The hub splits along those layers. [Theme setup and palettes](/topics/fe-angular-material-theming) and [style overrides and tokens](/topics/fe-angular-material-style-overrides) cover how the look is produced and how you may change it. The component sections are where everyday bugs live: [form fields and error states](/topics/fe-angular-material-form-fields), [datepickers and date adapters](/topics/fe-angular-material-date-pickers), [dialogs, snack bars and sheets](/topics/fe-angular-material-dialogs) and [tables, sorting and paging](/topics/fe-angular-material-tables). The CDK sections are the machinery under them: [overlays and portals](/topics/fe-angular-material-overlays), [virtual scrolling](/topics/fe-angular-material-virtual-scroll), [drag and drop lists](/topics/fe-angular-material-drag-drop) and [focus and keyboard utilities](/topics/fe-angular-material-a11y). [Headless widget primitives](/topics/fe-angular-material-headless) covers Angular Aria and the CDK's unstyled widgets for teams that own their design, and [test harnesses](/topics/fe-angular-material-harnesses) is how all of it gets tested. Junior rounds stay on wiring: which directive goes where, which provider must exist. Senior and principal rounds turn into diagnosis and design: why a restyle vanished after an upgrade, why a date reached the server a day early, and which layer a new in-house widget should sit on. Start with theming and form fields, then dialogs and tables. Read the CDK sections before building anything custom.

primer

### Three layers, one direction The **CDK** supplies behaviour with no look. **Angular Material** is CDK behaviour plus the Material 3 visual language. **Angular Aria** sits beside the CDK, applying whole WAI-ARIA patterns to markup you write. Senior rounds keep returning to the choice between them, widget by widget: is the Material look acceptable here, and which layer already implements the interaction in full? ### The theme is a set of CSS variables `mat.theme` is a Sass mixin, but what it leaves in the browser is a family of `--mat-sys-*` custom properties that components read at runtime. That one fact explains most theming answers: including the mixin again under a selector rescopes a region, light and dark follow the page's `color-scheme` rather than a second stylesheet, and your own components can follow the theme by reading the same variables. ### The supported surface is deliberately narrow You may change Material through its theme, its tokens, its inputs, its injection tokens and its harnesses. Its internal DOM and generated class names are not a contract. Upgrade stories test whether a candidate knows where that line is, because anything built past it breaks on a schedule nobody chose. ### Behaviour is delegated to swappable strategies Many components hand a decision to a replaceable object or function: when an error shows (`ErrorStateMatcher`), how text becomes a date (`DateAdapter`), where rows come from (`DataSource`), how an option value is matched or displayed (`compareWith`, `displayWith`), and where a floating panel goes (position and scroll strategies). A strong answer fixes a bug by replacing the strategy that owns it, not by patching its output. ### The CDK reports; your model decides Drag and drop tells you where an item was dropped but leaves your array alone. A virtual scroll viewport reuses row views for different items. A table renders whatever its data source emits. The source of truth is your data, keyed by a stable id; bugs appear when state hides in the DOM instead. ### Overlays live outside your component tree Dialogs, menus, select panels and datepicker popups render in an overlay, away from the element that opened them. That is how they escape clipping, and also why a region's scoped theme can miss them, why focus must be moved in and handed back, and why tests find them from the document root. ### Accessibility is built in, and its defaults are opinions Focus traps, key managers, a live announcer and focus-origin tracking come with the kit, and Material's components use them. Their defaults, such as which element receives focus on open or which arrow keys a list handles, are guesses about a typical screen; interviewers expect you to know which option changes each one.

Component Dev Kit (CDK)
The unstyled package under Angular Material that provides overlays, portals, virtual scrolling, drag and drop, accessibility utilities and test harness infrastructure, usable on its own.
Angular Aria
A headless Angular package whose directives apply WAI-ARIA widget patterns, such as listbox and combobox, to your own markup and styles.
mat.theme
The Sass mixin that takes colour, typography and density settings and emits the theme as CSS custom properties under the selector it is included in.
System variables
The --mat-sys-* custom properties a theme declares for colour roles, type scale, shape and elevation; Material components and your own styles read them.
Overrides mixin
A per-component Sass mixin, such as the card or button one, that sets that component's design tokens under a selector, the supported way to restyle it.
MatFormFieldControl
The contract a control implements so mat-form-field can draw its label, focus state, errors and described-by ids around it.
ErrorStateMatcher
The injectable rule that decides when a form control counts as in error, and so when its mat-error is shown.
DateAdapter
The abstraction Material's date components use to create, parse, format and compare dates; the adapter you provide fixes the date type and its parsing.
MatDialogRef
The handle returned when a dialog opens; it closes the dialog, exposes its lifecycle events and carries the typed result back to the opener.
DataSource
The CDK interface a table reads its rows from; MatTableDataSource implements it in memory, and a custom one can fetch from a server.
Overlay
The CDK service and container that render floating content above the page, positioned by a position strategy, governed by a scroll strategy, and filled through a portal.
Virtual scroll viewport
The CDK container that renders only the items near the visible area of a long list and reuses their views as the user scrolls.
Key manager
A CDK helper that tracks the active item in a list and moves it on arrow, Home and End keys, by focus or by aria-activedescendant.
Component harness
A test-only class that drives a component through a typed API, hiding its DOM and change detection from the test.

Follow one screen through the stack: a filterable order list. The theme is declared once at the root. The filter bar is a row of `mat-form-field`s around a select and a date input. The results are a `mat-table` fed by a data source that sorts and pages, in memory or on the server. Opening an order opens a dialog in the CDK overlay, the same layer the select panel and datepicker popup use; the CDK's accessibility utilities move focus in and back, and a snack bar confirms the action through a live region. Tests drive the screen through harnesses, never through Material's DOM. The CDK and Aria sections attach where Material stops: - **A list Material does not render** (a long audit log, a reorderable queue) uses virtual scrolling or drag and drop directly, with your own markup. - **A widget Material does not ship**, or one that must not look like Material, starts from the headless primitives and floats its popups with the overlay. - **Your own components** read the same system variables, so they follow light, dark and scoped regions with no extra wiring. The theme, a scoped region and a custom component meet in one stylesheet: ```scss @use '@angular/material' as mat; html { color-scheme: light dark; @include mat.theme((color: mat.$azure-palette, typography: Roboto, density: 0)); } .ops-console { @include mat.theme((density: -2)); } .order-summary { background: var(--mat-sys-surface-container); color: var(--mat-sys-on-surface); } ``` The scoped include changes only the variables it re-emits, and only for elements inside `.ops-console`; a dialog opened from there renders in the overlay, outside that element, and keeps the root density unless the theme is also applied where the overlay lives.

  1. Theme Setup & Palettes →

    Where every app begins: how one mixin produces the variables components read, and how palettes, fonts, density and dark mode are chosen.

  2. Form Fields & Error States →

    The component most screens use first, and the place error display, object values and custom controls are first asked about.

  3. Dialogs, Snack Bars & Sheets →

    Opening, feeding and closing overlays from a component, with the focus and close rules interviewers probe.

  4. Tables, Sorting & Paging →

    Column definitions, the in-memory data source and its limits, and when sorting and paging must move to the server.

  5. Overlays & Portals →

    The CDK mechanism under dialogs, menus and selects: positioning, scroll behaviour and escaping clipped containers.

  6. Focus & Keyboard Utilities →

    Focus traps, key managers and the live announcer, needed before building any custom widget on the CDK or Aria.

  • Restyling a component with ::ng-deep rules aimed at its internal classes; they are not a contract, so use style overrides and tokens instead.

  • Expecting a region's scoped theme to reach a dialog or menu opened from it; overlays render outside that element.

  • Assuming the datepicker parses typed dates by locale: the provided DateAdapter decides, and the native one does not read day-first text.

  • Handling the drop event without updating your array, then wondering why the dragged item snaps back.

  • Keeping row state in the DOM or in row component fields under virtual scrolling; recycled views carry it to other items.

  • Loading one server page into MatTableDataSource and attaching the paginator, which then pages and sorts only that page.

  • Assuming Angular Aria's combobox filters and positions its popup; it coordinates input and popup, and leaves both jobs to you.

This guide assumes Angular Material and the CDK at version 22, which release in step with Angular itself. Several questions still turn on how the kit got here, because many production apps are older: - **v15** moved the components onto implementations based on Material Design Components for the web, which renamed internal classes; the old implementations were removed in **v17**. Style overrides written against pre-15 class names are the classic upgrade break. - **v18** made Material 3 stable and renamed the Material 2 theming functions with an `m2-` prefix, so an M2 theme still compiles but follows a different API. - **v19** introduced the single `mat.theme` mixin and the `--mat-sys-*` system variables as the recommended way to theme, replacing per-component theme mixins for most apps. - **v21** added Angular Aria, the headless ARIA-pattern package, beside the CDK. The 22 line also lets the overlay render as a native popover, outside any clipping ancestor. When an answer depends on version, such as theming API, class names or overlay placement, say which one you mean.

Angular Material is weighed against two kinds of alternative. Third-party Angular component suites such as PrimeNG and NG-ZORRO offer more components and their own visual languages; Material offers a smaller set tied to Material Design and released in lockstep with Angular by the same team. The other alternative is to build your own design system, and there the usual answer is not to start from scratch but from the layers under Material: the CDK for overlays, scrolling, drag and drop and focus handling, and Angular Aria for full widget patterns applied to your own elements. A defensible choice names the constraint. A product with its own brand that cannot look like Material favours the headless layers; an internal tool that needs many accessible components quickly favours the kit. Around it, Material usually pairs with Angular's reactive forms, which supply the validation state its form fields display, and with a date library such as Luxon, date-fns or Moment through the matching adapter. Utility CSS frameworks can sit beside it for layout, as long as they leave Material's internals alone.

explore

report an issue with this guide →

questions

66 · 12 sections

In Angular Material 22, what does `ng add @angular/material` set up for theming, and how does a prebuilt theme CSS file differ?

level: juniorimportance: must knowfreq 55%
basics
~20 s

In Angular Material 22, ng add writes a mat.theme Sass block from the palette pair you choose, links the Roboto and Material Symbols fonts in index.html and starts the app in light mode. A prebuilt theme is a fixed, precompiled CSS file.

open as a page

In Angular Material 22, how do you build a custom `mat.theme` from a brand colour, a brand font and a density step?

level: middleimportance: must knowfreq 52%
basics
~20 s

Generate palettes from the brand hex with ng generate @angular/material:theme-color, then pass them, a font and a density step from 0 to -5 to mat.theme under html. It emits the CSS variables every component reads.

open as a page

In Angular Material 22, how do `color-scheme` and the CSS `light-dark()` function switch a `mat.theme` between light and dark?

level: middleimportance: should knowfreq 45%
basics
~20 s

By default mat.theme writes each colour variable as a light-dark(light, dark) pair, and the browser picks one from the color-scheme in effect. Declare color-scheme: light dark to follow the operating system, or light or dark on a toggled class.

open as a page

When moving an Angular Material app from an M2 theme built with `mat.m2-define-light-theme` to Material 3 in v22, what must change?

level: seniorimportance: should knowfreq 30%
basics
~20 s

No automated migration exists: replace the m2-define-* config and component theme mixins with one mat.theme under html, then handle what M3 drops, chiefly the color input's primary, accent and warn variants, M2 typography class names and custom mixins reading the M2 config.

open as a page

In Angular Material 22, how do you give one region, such as a dense control-room console, its own density or palette, and what does it cost?

level: seniorimportance: should knowfreq 32%
basics
~20 s

Include mat.theme again under the region's selector, passing only what changes, such as density: -2; the redeclared CSS variables inherit to the components inside. Each call re-emits that category's variable set, and a dialog attached outside the region misses it.

open as a page

In Angular Material 22, how do you restyle one component type, such as `mat-card`, with its overrides mixin, and how is that change scoped?

level: middleimportance: must knowfreq 45%
basics
~20 s

Include the component's overrides mixin, such as mat.card-overrides, with a map of its token names and values. It sets the card's CSS variables under the selector you include it in: html reaches every card, a class only the cards inside it.

open as a page

A university course-registration portal restyled Angular Material buttons with `::ng-deep .mdc-button--unelevated` rules, and the brand color vanished after an upgrade; why, and what is the supported fix?

level: seniorimportance: must knowfreq 41%
basics
~20 s

Angular Material treats each component's DOM structure and CSS classes as private details that can change in any release, so selectors aimed at them break without warning. The supported fix is the overrides mixins, such as mat.button-overrides, or the --mat-sys variables.

open as a page

In Angular Material 22, what are the `--mat-sys-*` CSS variables, and how do you use them to style your own components?

level: juniorimportance: should knowfreq 38%
basics
~20 s

They are CSS custom properties that Angular Material's mat.theme mixin declares for the theme's color roles, type scale, shapes and elevation. Your own styles read them, such as background: var(--mat-sys-surface), and follow the theme, light and dark values included.

open as a page

What does Angular Material 22's `mat.strong-focus-indicators()` mixin change about keyboard focus, and how do you adjust its outline?

level: seniorimportance: should knowfreq 24%
basics
~20 s

Most Angular Material components show focus only as a faint background tint by default. mat.strong-focus-indicators() turns on a visible keyboard-focus outline, 3px solid in the theme's secondary color by default; a config map and strong-focus-indicators-theme adjust it.

open as a page

In Angular Material 22, when do you change a system token with `mat.theme-overrides` instead of a component's overrides mixin, and what does each one reach?

level: seniorimportance: should knowfreq 31%
basics
~20 s

mat.theme-overrides, or mat.theme's $overrides map, rewrites a --mat-sys system variable, so every component and custom style reading it changes under that selector. A component overrides mixin sets only that component's tokens, which win over the system fallback.

open as a page

In Angular Material, how do you build a text field from mat-form-field, matInput, mat-label, mat-hint and mat-error, and what does each part do?

level: juniorimportance: must knowfreq 55%
basics
~20 s

mat-form-field wraps one control and draws its label, container and subscript line; matInput makes a native input that control. mat-label floats, mat-hint sits below, and mat-error takes the hint's place once the control is in an error state.

open as a page

In Angular Material, when does a mat-error inside mat-form-field become visible, and how do you change that rule with an ErrorStateMatcher?

level: middleimportance: must knowfreq 52%
basics
~20 s

A mat-error shows when the control's ErrorStateMatcher says so: by default, invalid and either touched or the parent form submitted. Pass a custom matcher to one control with [errorStateMatcher], or provide ErrorStateMatcher for a subtree or the app.

open as a page

In Angular Material, why does a mat-autocomplete of adjuster objects put [object Object] in the input, and what does displayWith change?

level: middleimportance: should knowfreq 38%
basics
~20 s

Picking an option writes its value into the input, and an object becomes the text [object Object]. displayWith maps the control value to display text while the control keeps the object; while typing, the control holds the typed string.

open as a page

In Angular Material, why does a mat-select with object option values show blank for a loaded record, and what does compareWith fix?

level: middleimportance: should knowfreq 42%
basics
~20 s

mat-select matches its value to options with === by default, so a record loaded separately holds a different object than the option list and nothing is selected. compareWith supplies a function that compares a stable key such as an id.

open as a page

In Angular Material 22, how do you make a composite bank-account control, with routing and account number inputs, work inside mat-form-field as a MatFormFieldControl?

level: seniorimportance: should knowfreq 30%
basics
~10 s

Implement the MatFormFieldControl contract: provide MatFormFieldControl with useExisting, expose id, ngControl, focused, empty, shouldLabelFloat, required, disabled and errorState, and implement setDescribedByIds and onContainerClick. In v22 state may be signals, making stateChanges optional.

open as a page

In Angular Material 22, how do you wire a mat-datepicker and its toggle to a text input, and what must the app provide first?

level: juniorimportance: must knowfreq 48%
basics
~10 s

Give the mat-datepicker a template reference, bind the input with [matDatepicker]="picker" and the mat-datepicker-toggle with [for]="picker", and provide a DateAdapter, for example provideNativeDateAdapter(), in the app config; without one the datepicker throws.

open as a page

In Angular Material 22, what do DateAdapter, MAT_DATE_FORMATS and MAT_DATE_LOCALE each decide, and how do you set them for German dates held as Luxon values?

level: middleimportance: must knowfreq 40%
basics
~20 s

DateAdapter decides the date type and how dates are parsed, formatted and compared; MAT_DATE_FORMATS holds the parse and display formats that adapter understands; MAT_DATE_LOCALE sets its locale. For Luxon: provideLuxonDateAdapter(germanFormats) plus MAT_DATE_LOCALE set to 'de'.

open as a page

With Angular Material's mat-date-range-input, how do you build a pick-up and return range that blocks unavailable dates, and what does the filter miss?

level: middleimportance: should knowfreq 34%
basics
~20 s

Wrap matStartDate and matEndDate inputs in mat-date-range-input, link it to a mat-date-range-picker with [rangePicker], and block days with [dateFilter], [min] and [max]. The filter only validates the two endpoints, so a range can still span a blocked day.

open as a page

German users of an Angular Material datepicker on provideNativeDateAdapter see 12.10.2026 in the input, but typing dates that way fails or lands on the wrong month; why, and what fixes it?

level: seniorimportance: should knowfreq 37%
basics
~20 s

NativeDateAdapter formats through Intl.DateTimeFormat in the German locale but parses typed text with Date.parse, ignoring both locale and parse format, so day-first text is rejected or read month-first. Switch to the date-fns, Luxon or Moment adapter with a German parse format.

open as a page

A Berlin car-rental page posts the date chosen in an Angular Material datepicker using the native adapter, and the server stores the day before; why, and how does the Luxon adapter fix it?

level: seniorimportance: should knowfreq 31%
basics
~20 s

The native adapter creates local-midnight Date values and JSON serialisation converts them to UTC, so 12 October in Berlin is sent as 2026-10-11T22:00Z. With Luxon, send toISODate(), or set useUtc or, since 22.2, a timeZone in MAT_LUXON_DATE_ADAPTER_OPTIONS.

open as a page

In Angular Material, how do you open an archive-project confirmation with `MatDialog` and read the user's choice in the component that opened it?

level: juniorimportance: must knowfreq 58%
basics
~10 s

Inject MatDialog and call open(ArchiveProjectDialog); it returns a MatDialogRef. Buttons close it with [mat-dialog-close]="true" or dialogRef.close(value), and afterClosed() emits that value to the opener, or undefined after Escape or a backdrop click.

open as a page

With Angular Material's `MatDialog`, how does an edit-task dialog receive its task through `MAT_DIALOG_DATA` and return the edited task as a typed result?

level: middleimportance: must knowfreq 50%
basics
~20 s

Pass the task as the data option of open(); the dialog reads it with inject(MAT_DIALOG_DATA). It is the same object, not a copy, so edit a copy and return a new task through a MatDialogRef typed with the result.

open as a page

In Angular Material, how do you build a "Project archived" snack bar with an Undo action using `MatSnackBar`, and when should the archive commit?

level: middleimportance: should knowfreq 42%
basics
~10 s

Call snackBar.open('Project archived', 'Undo', config) and keep the MatSnackBarRef. onAction() fires when Undo is pressed; afterDismissed() reports dismissedByAction, so commit the archive when the snack bar goes away without the action.

open as a page

In Angular Material 22, how do `disableClose`, `closePredicate` and `closeOnNavigation` decide when an edit-task `MatDialog` with unsaved changes may close?

level: seniorimportance: should knowfreq 30%
basics
~20 s

disableClose blocks only Escape and backdrop clicks; closePredicate is asked on every close() and can refuse it; closeOnNavigation closes on back/forward by default, and 'url-change' (22.2.1) closes on any URL change, without asking the predicate.

open as a page

An Angular Material `MatDialog` archive confirmation opened from a row menu focuses the Archive button, and focus vanishes after it closes; which `MatDialogConfig` options fix both?

level: seniorimportance: should knowfreq 34%
basics
~20 s

autoFocus defaults to 'first-tabbable', so the first button in the markup gets focus; aim it at Cancel with a CSS selector. restoreFocus: true targets the menu item, which is gone; pass a selector or element, or refocus in afterClosed().

open as a page

In Angular Material, how does a `mat-table` build its rows from `matColumnDef`, `matHeaderRowDef` and `matRowDef`?

level: juniorimportance: must knowfreq 58%
basics
~20 s

Each matColumnDef names a column and holds its header and cell templates. The header and data row definitions take a list of column names that decides which columns render and in what order, and the table stamps one data row per item.

open as a page

How do you connect `MatSort` and `MatPaginator` to Angular Material's `MatTableDataSource`, and in what order does it filter, sort and page rows?

level: middleimportance: must knowfreq 55%
basics
~20 s

Put matSort on the table and mat-sort-header on header cells, then assign the MatSort and MatPaginator instances to dataSource.sort and dataSource.paginator once the view exists. The data source filters, sorts the filtered rows, then slices the current page.

open as a page

Why do Angular Material's default `MatTableDataSource` filtering and sorting fail on nested or computed fields, and how do `filterPredicate` and `sortingDataAccessor` fix it?

level: middleimportance: should knowfreq 45%
basics
~20 s

The default filterPredicate stringifies each top-level value, so a nested object becomes [object Object], and the default sortingDataAccessor reads row[columnName], which is undefined for computed columns. Replace them with functions that return the exact text to match and the value to sort by.

open as a page

An Angular Material inventory table's catalogue is too large to load into the browser; how do you page and sort it on the server with `MatSort` and `MatPaginator`?

level: seniorimportance: should knowfreq 42%
basics
~20 s

Implement a DataSource whose connect() listens to MatSort.sortChange, MatPaginator.page and the filter, fetches only the requested page from the server, and sets the paginator's length to the server's total. Do not attach them to a MatTableDataSource holding one page.

open as a page

In Angular Material's `mat-table`, how do you pin the SKU column while scrolling, add an expandable detail row, and what does `multiTemplateDataRows` change?

level: seniorimportance: should knowfreq 32%
basics
~20 s

Add sticky to the SKU column's matColumnDef (stickyEnd pins a column to the end, sticky: true in matHeaderRowDef pins the header). For detail rows, add a second matRowDef and set multiTemplateDataRows so each item can render more than one row.

open as a page

With the Angular CDK 22 overlay, how do you anchor a component to an element using createOverlayRef, a connected position strategy and a portal?

level: middleimportance: must knowfreq 42%
basics
~10 s

Build createFlexibleConnectedPositionStrategy(injector, cell).withPositions([...]), pass it as positionStrategy to createOverlayRef(injector, config), then attach a ComponentPortal of the editor. Keep the OverlayRef and call dispose() when you are done.

open as a page

In an Angular template, how do the CDK's cdkOverlayOrigin and cdkConnectedOverlay directives open a panel, and which defaults do they apply that createOverlayRef does not?

level: middleimportance: should knowfreq 38%
basics
~20 s

Mark the trigger with cdkOverlayOrigin and put cdkConnectedOverlay on an ng-template whose Origin and Open inputs point at it. The directive adds dropdown positions, a reposition scroll strategy and Escape-to-close, defaults a code-built overlay lacks.

open as a page

With the Angular CDK's flexible connected position strategy, how is a fallback chosen when the preferred position does not fit, and what do push and flexible dimensions change?

level: seniorimportance: should knowfreq 30%
basics
~20 s

The strategy applies the first listed position that fits the viewport completely; otherwise a position that fits after shrinking to minWidth or minHeight; otherwise it pushes the least off-screen one into view; otherwise it uses that one as is.

open as a page

In Angular CDK 22, how does an overlay escape a scrolling grid's overflow clipping, and what do usePopover, withPopoverLocation and the OverlayContainer change?

level: seniorimportance: should knowfreq 31%
basics
~20 s

A CDK 22 overlay's host becomes a manual popover drawn in the browser's top layer, so ancestor overflow cannot clip it; without popover support it sits in the OverlayContainer under body. withPopoverLocation only moves the popover in the DOM.

open as a page

With the Angular CDK overlay, how do the noop, reposition, block and close scroll strategies differ, and which suits a cell editor inside a scrolling spreadsheet grid?

level: seniorimportance: should knowfreq 33%
basics
~20 s

Noop ignores scrolling, reposition re-runs the position strategy so the overlay follows its anchor, block freezes document scrolling, and close detaches the overlay. A grid's cell editor usually wants reposition or close; block does not stop the grid's own scrolling.

open as a page

How does the Angular CDK's cdk-virtual-scroll-viewport show a 100,000-line audit log without creating 100,000 DOM rows?

level: juniorimportance: must knowfreq 40%
basics
~20 s

The viewport sizes an empty spacer to the whole list's height so the scrollbar looks right, then renders only the rows in view plus a small buffer, shifting them into place with a CSS transform.

open as a page

In the Angular CDK's fixed-size virtual scroll strategy, what do itemSize, minBufferPx and maxBufferPx control, and what breaks when rows aren't itemSize tall?

level: middleimportance: must knowfreq 36%
basics
~20 s

itemSize is the pixel height assumed for every row and drives total height, visible index and offsets; minBufferPx is the least off-screen buffer allowed, maxBufferPx the level refilled to. Rows of another height make content jump.

open as a page

With the Angular CDK's virtual scroll viewport, how do you build a jump-to-entry box with scrollToIndex and a 'line N of M' readout with scrolledIndexChange?

level: middleimportance: should knowfreq 32%
basics
~20 s

Query the CdkVirtualScrollViewport, convert the typed entry number to a zero-based data index and call scrollToIndex(index); bind (scrolledIndexChange) to a signal that holds the first visible index and show it plus one, of the list length.

open as a page

In an Angular CDK virtual scroll of a message thread whose rows differ in height, what are your options, and what does each cost?

level: seniorimportance: should knowfreq 27%
basics
~20 s

Make rows uniform so the fixed-size strategy works; use the experimental autosize directive, which estimates heights but lacks scrollToIndex and scrolledIndexChange; or write a custom VirtualScrollStrategy provided through VIRTUAL_SCROLL_STRATEGY that computes offsets from heights you know.

open as a page

In the Angular CDK's *cdkVirtualFor, why does a row's checkbox state show up on a different audit entry after scrolling, and how do you fix it?

level: seniorimportance: should knowfreq 24%
basics
~20 s

*cdkVirtualFor recycles detached row views through a template cache and swaps only their context item, so unbound DOM state and a child component's fields travel to whichever entry reuses the view. Keep row state keyed by entry id.

open as a page

With the Angular CDK's cdkDropList and cdkDrag directives, how do you make a playlist reorderable, and why would a dragged track snap back?

level: juniorimportance: must knowfreq 44%
basics
~20 s

In the Angular CDK, put cdkDropList on the container and cdkDrag on each row, handle cdkDropListDropped by calling moveItemInArray with previousIndex and currentIndex. The CDK never reorders your array, so without that handler the row returns to its slot.

open as a page

In the Angular CDK drag-drop module, how do you connect a track library to a play queue so tracks can move between them?

level: middleimportance: must knowfreq 40%
basics
~20 s

Connect the Angular CDK drop lists with cdkDropListConnectedTo, by reference or id, or wrap them in cdkDropListGroup. Bind each array with cdkDropListData, and in the drop handler call moveItemInArray for the same list or transferArrayItem across lists.

open as a page

In the Angular CDK, what do cdkDragHandle, cdkDragPreview and cdkDragPlaceholder each customise when a playlist row is dragged?

level: middleimportance: should knowfreq 33%
basics
~20 s

In the Angular CDK, cdkDragHandle limits where a drag may start, a cdkDragPreview template replaces the floating copy that follows the pointer, and a cdkDragPlaceholder template replaces the clone that marks where the row will land.

open as a page

In a form builder using Angular CDK drag-drop, how do you copy field types from a palette onto a canvas without emptying or reordering the palette?

level: seniorimportance: should knowfreq 24%
basics
~20 s

Connect the Angular CDK palette list one way to the canvas, set cdkDropListSortingDisabled and cdkDropListHasAnchor on the palette, and in the canvas drop handler insert a new field instance rather than the palette's own object, which copyArrayItem would share.

open as a page

In an Angular CDK playlist editor, how do cdkDropListEnterPredicate and cdkDropListSortPredicate keep explicit tracks out of a kids queue and pin the opening track?

level: seniorimportance: should knowfreq 26%
basics
~20 s

In the Angular CDK, cdkDropListEnterPredicate(drag, drop) decides whether a list accepts an incoming item, and cdkDropListSortPredicate(index, drag, drop) decides whether an item may move to an index. Both return booleans, run during the drag and read the item through cdkDragData.

open as a page

Why does the Angular CDK's `cdkTrapFocus` on a custom filter drawer neither move focus in on open nor return it on close?

level: middleimportance: must knowfreq 34%
basics
~20 s

cdkTrapFocus only keeps Tab and Shift+Tab cycling inside its element and never captures focus by default. Add cdkTrapFocusAutoCapture: it focuses the cdkFocusInitial or first tabbable element on init and refocuses the previous element when the directive is destroyed.

open as a page

When building a custom list widget on the Angular CDK, when do you choose `FocusKeyManager` over `ActiveDescendantKeyManager`, and what must each item implement?

level: seniorimportance: must knowfreq 30%
basics
~20 s

FocusKeyManager moves DOM focus to the active item, which implements focus(). ActiveDescendantKeyManager keeps focus on the host and calls setActiveStyles() and setInactiveStyles(); the host's aria-activedescendant names the item's id. Use it when focus must stay in an input.

open as a page

Why does a filter-chip toolbar built on the Angular CDK's `FocusKeyManager` ignore the Left and Right arrow keys, and which configuration fixes it?

level: middleimportance: should knowfreq 21%
basics
~20 s

A ListKeyManager such as FocusKeyManager handles only Up and Down by default; horizontal movement is off until withHorizontalOrientation('ltr' or 'rtl') is called. Chain withVerticalOrientation(false), withWrap() and withHomeAndEnd() as needed, and forward keydown events to onKeydown.

open as a page

How do you make screen readers announce 'Filters applied' with the Angular CDK's `LiveAnnouncer`, and what do its politeness and duration arguments change?

level: middleimportance: should knowfreq 28%
basics
~20 s

Inject LiveAnnouncer and call announce('Filters applied'). It writes the text into one shared, visually hidden aria-live element; politeness defaults to polite, assertive interrupts, and duration clears the text that many milliseconds after it is written.

open as a page

How do you show focus rings on custom filter chips only for keyboard users with the Angular CDK's `FocusMonitor`, and what breaks after programmatic focus?

level: seniorimportance: should knowfreq 24%
basics
~20 s

FocusMonitor.monitor(element) reports how focus arrived, as keyboard, mouse, touch or program, and adds classes such as cdk-keyboard-focused, so a ring styled on that class shows only for keyboard focus. A plain focus() call reports program; use focusVia(element, origin).

open as a page

In Angular Aria, what does adding `ngListbox` and `ngOption` to your own elements give you, and what is still left for you to build?

level: middleimportance: must knowfreq 32%
basics
~20 s

Angular Aria's ngListbox and ngOption add the WAI-ARIA listbox pattern to elements you write: roles and ARIA states, arrow-key and typeahead navigation, focus management and selection in a value array. Markup, styles, data and filtering stay yours.

open as a page

In Angular Aria 22, a document editor's mention picker built from `ngCombobox` and an `ngListbox` popup lists every user whatever is typed and renders inline; why, and what fixes it?

level: seniorimportance: should knowfreq 24%
basics
~20 s

Angular Aria's combobox only coordinates an input with its popup: ARIA states, expansion and keyboard forwarding. It neither filters nor positions. Filter options with a computed signal over the combobox's text value, and place the popup with the CDK's connected overlay.

open as a page

A publish wizard built by extending the Angular CDK's `CdkStepper` fails with 'No provider found for CdkStepper' from its `<cdk-step>` children; why, and what else must the subclass supply?

level: seniorimportance: should knowfreq 28%
basics
~20 s

CdkStep and the cdkStepperNext and cdkStepperPrevious buttons inject CdkStepper, but a subclass component is registered under its own class. Provide CdkStepper with useExisting pointing at the subclass, then supply the template: step content, headers, navigation and ARIA.

open as a page

After moving a document editor's Angular CDK `cdk-tree` file explorer from `treeControl` to `childrenAccessor`, folders open by toggle click but not Right Arrow and lose `aria-expanded`; why?

level: seniorimportance: should knowfreq 26%
basics
~20 s

Without a treeControl, a cdk-tree-node is expandable only when its isExpandable input says so, and it defaults to false. Keyboard expansion and aria-expanded honour that flag, while cdkTreeNodeToggle calls the tree directly. Bind isExpandable on every folder node.

open as a page

For a document editor's in-house Angular component kit, how do you decide per widget between Angular Aria, the Angular CDK primitives and Angular Material 22?

level: principalimportance: should knowfreq 18%
basics
~20 s

Pick per widget by who owns the look and which layer fully implements the pattern: Material if its Material 3 look is acceptable, a CDK primitive if it ships the needed roles, Angular Aria for complete ARIA patterns on your markup.

open as a page

Testing a recipe search form, what do Angular Material's MatInputHarness and MatSelectHarness spare you compared with querying the components' DOM directly?

level: middleimportance: must knowfreq 35%
basics
~20 s

They hide Material's internal DOM, fire the right events, wait for the fixture to settle, and find controls by label. When a Material release restructures a component, its harness changes in the same release, sparing your tests.

open as a page

In an Angular Material 22 test, where do you import MatButtonHarness from, and how do you click the recipe form's Save button through it?

level: juniorimportance: should knowfreq 30%
basics
~10 s

Import it from the button's own testing entry point, @angular/material/button/testing, load it with MatButtonHarness.with({text: 'Save'}), then await its click(). Harness calls are asynchronous and run change detection themselves.

open as a page

Testing a delete-recipe confirmation opened with Angular Material's MatDialog, what can MatDialogHarness check and do, and how do you test the dialog component on its own?

level: seniorimportance: should knowfreq 22%
basics
~20 s

MatDialogHarness, loaded from the document root, reads the title, content and actions text plus role and ARIA attributes, finds buttons inside the dialog, and closes it by pressing Escape. MatTestDialogOpener opens the dialog component alone and records its result.

open as a page

With Angular Material's MatSelectHarness, how do you open the diet select and pick options, and how does clickOptions behave in single versus multiple mode?

level: seniorimportance: should knowfreq 24%
basics
~20 s

Call open() and getOptions() to read the options, or clickOptions(filter), which opens the panel itself. On a single select it clicks the first match; on a multiple select it clicks every match, and it throws when nothing matches.

open as a page

How do you assert the rows of an Angular Material results table with MatTableHarness, and what do its cell-text methods return?

level: seniorimportance: nice to knowfreq 18%
basics
~10 s

MatTableHarness gives row and cell harnesses plus two shortcuts: getCellTextByIndex() returns a string grid of the data rows, and getCellTextByColumnName() returns, per column, the data, header and footer texts.

open as a page