@angular/cdk
Angular Component Dev Kit — a set of behavior primitives for building accessible, high-quality UI components without prescribing any visual style.
@angular/cdk
AngularAngular Component Dev Kit — a set of behavior primitives for building accessible, high-quality UI components without prescribing any visual style.
Fit
Bundle (gzip)
216 B
260 B raw
Install size includes transitive dependencies. Bundle size is gzipped browser payload.
Freshness
The Problem
Building custom UI components in Angular that work correctly — with keyboard navigation, focus management, accessibility (ARIA), drag-and-drop, virtual scrolling, and overlay positioning — requires an enormous amount of low-level wiring. Doing this by hand leads to inconsistent behavior, accessibility failures, and weeks of reinventing the wheel across projects.
What It Does
The Angular CDK provides battle-tested, unstyled building blocks for common UI patterns: overlays and portals, drag-and-drop with sorting, virtual scroll for large lists, an accessibility module (FocusTrap, LiveAnnouncer), stepper, table, tree, and more. You bring the styles; CDK handles the hard behavioral logic so your custom components are correct from day one.
Installation
npm install @angular/cdkUsage Example
// app.module.ts — enable drag-and-drop
import { DragDropModule } from '@angular/cdk/drag-drop';
@NgModule({
imports: [DragDropModule],
})
export class AppModule {}
// task-list.component.ts
import { Component } from '@angular/core';
import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';
@Component({
selector: 'app-task-list',
template: `
<div cdkDropList (cdkDropListDropped)="drop($event)">
<div *ngFor="let task of tasks" cdkDrag class="task-item">
{{ task }}
</div>
</div>
`,
styles: [`.task-item { padding: 12px; border: 1px solid #ccc; cursor: move; }`]
})
export class TaskListComponent {
tasks = ['Write tests', 'Review PR', 'Deploy to staging', 'Update docs'];
drop(event: CdkDragDrop<string[]>) {
moveItemInArray(this.tasks, event.previousIndex, event.currentIndex);
}
}Related packages
Official Material Design component library for Angular — 30+ accessible, themeable UI components built for Angular's ecosystem.
@ng-bootstrap/ng-bootstrapAngularAngular widgets built from scratch using Bootstrap CSS — no jQuery, no Popper.js, just pure Angular components.
ng-zorro-antdAngularEnterprise-grade UI component library for Angular based on Ant Design — 60+ production-ready components with a polished design system.
@ngneat/until-destroyAngularAutomatic RxJS subscription cleanup for Angular components — no more manual unsubscribe logic in ngOnDestroy.
@ngrx/storeAngularReactive state management for Angular apps built on RxJS — a predictable, unidirectional data flow inspired by Redux.