An enterprise-class Angular UI component library based on Ant Design with 70+ high-quality components for building modern Angular applications
—
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Pending
The risk profile of this skill
Components for providing user feedback and system status including modals, messages, notifications, and progress indicators.
Modal dialog system for displaying content in an overlay layer with backdrop.
/**
* Modal service for programmatic modal creation
*/
interface NzModalService {
/** Create a modal dialog */
create<T>(config: NzModalOptions<T>): NzModalRef<T>;
/** Create a confirmation modal */
confirm(options: NzModalConfirmOptions): NzModalRef;
/** Create an info modal */
info(options: NzModalOptions): NzModalRef;
/** Create a success modal */
success(options: NzModalOptions): NzModalRef;
/** Create an error modal */
error(options: NzModalOptions): NzModalRef;
/** Create a warning modal */
warning(options: NzModalOptions): NzModalRef;
/** Close all modals */
closeAll(): void;
/** Observable that emits when all modals are closed */
readonly afterAllClose: Observable<void>;
/** Get currently open modals */
get openModals(): NzModalRef[];
}
/**
* Modal component
* Selector: nz-modal
*/
interface NzModalComponent<T = any> {
/** Modal visible state */
nzVisible: boolean;
/** Modal closable */
nzClosable: boolean;
/** OK loading state */
nzOkLoading: boolean;
/** OK disabled state */
nzOkDisabled: boolean;
/** Cancel disabled state */
nzCancelDisabled: boolean;
/** Cancel loading state */
nzCancelLoading: boolean;
/** Keyboard support */
nzKeyboard: boolean;
/** Mask */
nzMask: boolean;
/** Mask closable */
nzMaskClosable: boolean;
/** OK text */
nzOkText: string | null;
/** OK type */
nzOkType: 'primary' | 'ghost' | 'dashed' | 'link' | 'text' | 'default' | 'danger';
/** OK danger */
nzOkDanger: boolean;
/** Cancel text */
nzCancelText: string | null;
/** Modal title */
nzTitle: string | TemplateRef<{}> | null;
/** Modal content */
nzContent: string | TemplateRef<{}> | Type<T> | null;
/** Component params */
nzComponentParams: Partial<T>;
/** Modal footer */
nzFooter: string | TemplateRef<{}> | Array<ModalButtonOptions<T>> | null;
/** Get container */
nzGetContainer: HTMLElement | OverlayRef | (() => HTMLElement | OverlayRef) | null;
/** Z index */
nzZIndex: number;
/** Modal width */
nzWidth: number | string;
/** Wrap class name */
nzWrapClassName: string;
/** Modal class name */
nzClassName: string;
/** Modal style */
nzStyle: object;
/** Mask style */
nzMaskStyle: object;
/** Body style */
nzBodyStyle: object;
/** Icon type */
nzIconType: string;
/** Auto focus */
nzAutofocus: 'ok' | 'cancel' | 'auto' | null;
/** Centered */
nzCentered: boolean;
/** Draggable */
nzDraggable: boolean;
/** After open */
nzAfterOpen: EventEmitter<void>;
/** After close */
nzAfterClose: EventEmitter<any>;
/** OK click event */
nzOnOk: EventEmitter<T> | OnClickCallback<T> | null;
/** Cancel click event */
nzOnCancel: EventEmitter<T> | OnClickCallback<T> | null;
/** Visible change event */
nzVisibleChange: EventEmitter<boolean>;
}
/**
* Modal reference for programmatically created modals
*/
interface NzModalRef<T = any, R = any> {
/** After open observable */
afterOpen: Observable<void>;
/** After close observable */
afterClose: Observable<R>;
/** Close modal */
close(result?: R): void;
/** Destroy modal */
destroy(result?: R): void;
/** Get content component instance */
getContentComponent(): T;
/** Trigger OK */
triggerOk(): void;
/** Trigger Cancel */
triggerCancel(): void;
/** Get component instance */
componentInstance: T | null;
}
// Types
interface NzModalOptions<T = any, D = any> extends NzModalOptionsForService<T> {
nzOnOk?: OnClickCallback<T>;
nzOnCancel?: OnClickCallback<T>;
}
interface NzModalConfirmOptions<T = any> extends NzModalOptions<T> {
nzIconType?: string;
}
type OnClickCallback<T> = (instance: T) => (false | void | {}) | Promise<false | void | {}>;
interface ModalButtonOptions<T = any> {
label: string;
type?: string;
shape?: string;
ghost?: boolean;
size?: string;
autoLoading?: boolean;
show?: boolean | ((this: ModalButtonOptions<T>, contentComponentInstance?: T) => boolean);
loading?: boolean | ((this: ModalButtonOptions<T>, contentComponentInstance?: T) => boolean);
disabled?: boolean | ((this: ModalButtonOptions<T>, contentComponentInstance?: T) => boolean);
onClick?(this: ModalButtonOptions<T>, contentComponentInstance?: T): any;
}
// Module
class NzModalModule {
static forRoot(): ModuleWithProviders<NzModalModule>;
}Usage Examples:
import { NzModalService, NzModalModule } from 'ng-zorro-antd/modal';
@Component({
template: `
<!-- Template modal -->
<nz-modal [(nzVisible)]="isVisible" nzTitle="Basic Modal" (nzOnOk)="handleOk()" (nzOnCancel)="handleCancel()">
<ng-container *nzModalContent>
<p>Some contents...</p>
<p>Some contents...</p>
<p>Some contents...</p>
</ng-container>
</nz-modal>
<button nz-button nzType="primary" (click)="showModal()">Open Modal</button>
<button nz-button nzType="primary" (click)="showConfirm()">Show Confirm</button>
`
})
export class ModalExampleComponent {
isVisible = false;
constructor(private modal: NzModalService) {}
showModal(): void {
this.isVisible = true;
}
showConfirm(): void {
this.modal.confirm({
nzTitle: 'Do you Want to delete these items?',
nzContent: 'When clicked the OK button, this dialog will be closed after 1 second',
nzOnOk: () => console.log('OK')
});
}
handleOk(): void {
this.isVisible = false;
}
handleCancel(): void {
this.isVisible = false;
}
}Global message display service for showing feedback messages.
/**
* Message service for global message display
*/
interface NzMessageService {
/** Show success message */
success(content: string | TemplateRef<void>, options?: NzMessageDataOptions): NzMessageDataFilled;
/** Show error message */
error(content: string | TemplateRef<void>, options?: NzMessageDataOptions): NzMessageDataFilled;
/** Show info message */
info(content: string | TemplateRef<void>, options?: NzMessageDataOptions): NzMessageDataFilled;
/** Show warning message */
warning(content: string | TemplateRef<void>, options?: NzMessageDataOptions): NzMessageDataFilled;
/** Show loading message */
loading(content: string | TemplateRef<void>, options?: NzMessageDataOptions): NzMessageDataFilled;
/** Create a new message */
create(type: 'success' | 'info' | 'warning' | 'error' | 'loading' | string, content: string | TemplateRef<void>, options?: NzMessageDataOptions): NzMessageDataFilled;
/** Remove a message */
remove(messageId?: string): void;
/** Remove all messages */
removeAll(): void;
}
/**
* Message component (internal)
* Selector: nz-message
*/
interface NzMessageComponent {
/** Message data */
nzMessage: NzMessageData;
/** Message index */
nzIndex: number;
}
// Types
interface NzMessageDataOptions {
nzDuration?: number;
nzAnimate?: boolean;
nzPauseOnHover?: boolean;
}
interface NzMessageData {
content?: string | TemplateRef<void>;
html?: string;
type?: 'success' | 'info' | 'warning' | 'error' | 'loading' | string;
duration?: number;
messageId?: string;
options?: NzMessageDataOptions;
state?: 'enter' | 'leave';
createdAt?: Date;
}
interface NzMessageDataFilled extends Required<NzMessageData> {
onClose?: Subject<boolean>;
}
// Module
class NzMessageModule {
static forRoot(): ModuleWithProviders<NzMessageModule>;
}Notification service for complex message display with actions.
/**
* Notification service for complex notifications
*/
interface NzNotificationService {
/** Show success notification */
success(title: string, content: string | TemplateRef<void>, options?: NzNotificationDataOptions): NzNotificationDataFilled;
/** Show error notification */
error(title: string, content: string | TemplateRef<void>, options?: NzNotificationDataOptions): NzNotificationDataFilled;
/** Show info notification */
info(title: string, content: string | TemplateRef<void>, options?: NzNotificationDataOptions): NzNotificationDataFilled;
/** Show warning notification */
warning(title: string, content: string | TemplateRef<void>, options?: NzNotificationDataOptions): NzNotificationDataFilled;
/** Show blank notification */
blank(title: string, content: string | TemplateRef<void>, options?: NzNotificationDataOptions): NzNotificationDataFilled;
/** Create notification */
create(type: 'success' | 'info' | 'warning' | 'error' | 'blank' | string, title: string, content: string | TemplateRef<void>, options?: NzNotificationDataOptions): NzNotificationDataFilled;
/** Remove notification */
remove(notificationId?: string): void;
/** Remove all notifications */
removeAll(): void;
}
/**
* Notification component (internal)
* Selector: nz-notification
*/
interface NzNotificationComponent {
/** Notification data */
nzNotification: NzNotificationData;
/** Notification index */
nzIndex: number;
}
// Types
interface NzNotificationDataOptions {
nzKey?: string;
nzStyle?: NgStyleInterface;
nzClass?: NgClassInterface;
nzCloseIcon?: TemplateRef<void> | string;
nzHtml?: string;
nzData?: any;
nzDuration?: number;
nzAnimate?: boolean;
nzPauseOnHover?: boolean;
nzPlacement?: 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';
}
interface NzNotificationData {
title?: string | TemplateRef<void>;
content?: string | TemplateRef<void>;
html?: string;
type?: 'success' | 'info' | 'warning' | 'error' | 'blank' | string;
key?: string;
messageId?: string;
options?: NzNotificationDataOptions;
state?: 'enter' | 'leave';
createdAt?: Date;
}
interface NzNotificationDataFilled extends Required<NzNotificationData> {
onClose?: Subject<boolean>;
}
// Module
class NzNotificationModule {
static forRoot(): ModuleWithProviders<NzNotificationModule>;
}Alert component for displaying important information and messages.
/**
* Alert component
* Selector: nz-alert
*/
interface NzAlertComponent {
/** Alert type */
nzType: 'success' | 'info' | 'warning' | 'error';
/** Closable alert */
nzCloseable: boolean;
/** Show icon */
nzShowIcon: boolean;
/** Alert banner */
nzBanner: boolean;
/** Alert message */
nzMessage: string | TemplateRef<void>;
/** Alert description */
nzDescription: string | TemplateRef<void>;
/** Close text */
nzCloseText: string | TemplateRef<void>;
/** Icon type */
nzIconType: NgClassInterface | string | null;
/** Action */
nzAction: string | TemplateRef<void>;
/** Close event */
nzOnClose: EventEmitter<boolean>;
}
// Module
class NzAlertModule {
static forRoot(): ModuleWithProviders<NzAlertModule>;
}Progress component for showing the completion progress of tasks.
/**
* Progress component
* Selector: nz-progress
*/
interface NzProgressComponent {
/** Progress type */
nzType: 'line' | 'circle' | 'dashboard';
/** Progress percent */
nzPercent: number;
/** Progress status */
nzStatus: 'success' | 'exception' | 'active' | 'normal';
/** Show progress info */
nzShowInfo: boolean;
/** Stroke width */
nzStrokeWidth: number;
/** Stroke line cap */
nzStrokeLinecap: 'round' | 'square';
/** Stroke color */
nzStrokeColor: string | string[] | { from: string; to: string; direction: string };
/** Trail color */
nzTrailColor: string;
/** Canvas width */
nzWidth: number;
/** Gap degree for dashboard */
nzGapDegree: number;
/** Gap position for dashboard */
nzGapPosition: 'top' | 'bottom' | 'left' | 'right';
/** Circle size */
nzSize: 'default' | 'small';
/** Steps count */
nzSteps: number;
/** Success percent */
nzSuccessPercent: number;
/** Format function */
nzFormat: (percent: number) => string;
}
// Module
class NzProgressModule {
static forRoot(): ModuleWithProviders<NzProgressModule>;
}Drawer component for panel-like content that slides in from screen edge.
/**
* Drawer service for programmatic drawer creation
*/
interface NzDrawerService {
/** Create a drawer */
create<T = any, D = any, R = any>(options: NzDrawerOptions<T, D>): NzDrawerRef<T, R>;
}
/**
* Drawer component
* Selector: nz-drawer
*/
interface NzDrawerComponent<T = any, R = any> {
/** Drawer content */
nzContent: TemplateRef<{ $implicit: any; drawerRef: NzDrawerRef<R> }> | Type<T>;
/** Drawer closable */
nzClosable: boolean;
/** Mask closable */
nzMaskClosable: boolean;
/** Show mask */
nzMask: boolean;
/** Keyboard support */
nzKeyboard: boolean;
/** Drawer title */
nzTitle: string | TemplateRef<{}>;
/** Drawer placement */
nzPlacement: 'top' | 'right' | 'bottom' | 'left';
/** Mask style */
nzMaskStyle: NgStyleInterface;
/** Body style */
nzBodyStyle: NgStyleInterface;
/** Wrap class name */
nzWrapClassName: string;
/** Drawer width */
nzWidth: number | string;
/** Drawer height */
nzHeight: number | string;
/** Z index */
nzZIndex: number;
/** Offset X */
nzOffsetX: number;
/** Offset Y */
nzOffsetY: number;
/** Drawer visible */
nzVisible: boolean;
/** Close icon */
nzCloseIcon: string | TemplateRef<void> | null;
/** Extra content */
nzExtra: string | TemplateRef<void>;
/** Footer content */
nzFooter: string | TemplateRef<void>;
/** Close event */
nzOnClose: EventEmitter<MouseEvent>;
/** Visible change event */
nzOnViewInit: EventEmitter<void>;
}
/**
* Drawer reference for programmatically created drawers
*/
interface NzDrawerRef<T = any, R = any> {
/** After open observable */
afterOpen: Observable<void>;
/** After close observable */
afterClose: Observable<R>;
/** Close drawer */
close(result?: R): void;
/** Open drawer */
open(): void;
/** Get content component instance */
getContentComponent(): T | null;
}
// Types
interface NzDrawerOptions<T = any, D = any> extends NzDrawerOptionsOfComponent {
nzContent?: TemplateRef<{ $implicit: D; drawerRef: NzDrawerRef }> | Type<T>;
nzContentParams?: Partial<T & D>;
nzOnCancel?(this: NzDrawerRef): void;
}
interface NzDrawerOptionsOfComponent {
nzClosable?: boolean;
nzMaskClosable?: boolean;
nzMask?: boolean;
nzKeyboard?: boolean;
nzTitle?: string | TemplateRef<{}>;
nzContent?: TemplateRef<{}> | Type<any>;
nzData?: any;
nzMaskStyle?: NgStyleInterface;
nzBodyStyle?: NgStyleInterface;
nzWrapClassName?: string;
nzWidth?: number | string;
nzHeight?: number | string;
nzPlacement?: 'top' | 'right' | 'bottom' | 'left';
nzZIndex?: number;
nzOffsetX?: number;
nzOffsetY?: number;
}
// Module
class NzDrawerModule {
static forRoot(): ModuleWithProviders<NzDrawerModule>;
}Popconfirm directive for displaying confirmation popover.
/**
* Popconfirm directive
* Selector: [nz-popconfirm]
*/
interface NzPopconfirmDirective {
/** Popconfirm title */
nzPopconfirmTitle: string | TemplateRef<void>;
/** Trigger type */
nzTrigger: 'click' | 'focus' | 'hover';
/** Placement */
nzPopconfirmPlacement: string;
/** OK text */
nzOkText: string;
/** OK type */
nzOkType: 'primary' | 'ghost' | 'dashed' | 'link' | 'text' | 'default' | 'danger';
/** OK danger */
nzOkDanger: boolean;
/** Cancel text */
nzCancelText: string;
/** Condition for showing */
nzCondition: boolean;
/** Icon */
nzIcon: string | TemplateRef<void>;
/** Auto focus */
nzAutoFocus: 'ok' | 'cancel' | null;
/** Popconfirm visible */
nzPopconfirmVisible: boolean;
/** Show arrow */
nzPopconfirmShowArrow: boolean;
/** Backdrop */
nzPopconfirmBackdrop: boolean;
/** Overlay class name */
nzPopconfirmOverlayClassName: string;
/** Overlay style */
nzPopconfirmOverlayStyle: NgStyleInterface;
/** Mouse enter delay */
nzPopconfirmMouseEnterDelay: number;
/** Mouse leave delay */
nzPopconfirmMouseLeaveDelay: number;
/** Confirm event */
nzOnConfirm: EventEmitter<void>;
/** Cancel event */
nzOnCancel: EventEmitter<void>;
/** Visible change event */
nzPopconfirmVisibleChange: EventEmitter<boolean>;
}
// Module
class NzPopconfirmModule {
static forRoot(): ModuleWithProviders<NzPopconfirmModule>;
}Result component for displaying operation results.
/**
* Result component
* Selector: nz-result
*/
interface NzResultComponent {
/** Result icon */
nzIcon: string | TemplateRef<void>;
/** Result status */
nzStatus: 'success' | 'error' | 'info' | 'warning' | '404' | '403' | '500';
/** Result title */
nzTitle: string | TemplateRef<void>;
/** Result subtitle */
nzSubTitle: string | TemplateRef<void>;
/** Extra content */
nzExtra: string | TemplateRef<void>;
}
/**
* Result title directive
* Selector: [nz-result-title]
*/
interface NzResultTitleDirective {}
/**
* Result subtitle directive
* Selector: [nz-result-subtitle]
*/
interface NzResultSubtitleDirective {}
/**
* Result content directive
* Selector: [nz-result-content]
*/
interface NzResultContentDirective {}
/**
* Result extra directive
* Selector: [nz-result-extra]
*/
interface NzResultExtraDirective {}
/**
* Result icon directive
* Selector: [nz-result-icon]
*/
interface NzResultIconDirective {}
// Module
class NzResultModule {
static forRoot(): ModuleWithProviders<NzResultModule>;
}Skeleton component for showing loading placeholders.
/**
* Skeleton component
* Selector: nz-skeleton
*/
interface NzSkeletonComponent {
/** Show skeleton */
nzActive: boolean;
/** Show avatar */
nzAvatar: boolean | NzSkeletonAvatar;
/** Loading state */
nzLoading: boolean;
/** Show paragraph */
nzParagraph: boolean | NzSkeletonParagraph;
/** Show title */
nzTitle: boolean | NzSkeletonTitle;
/** Rounded skeleton */
nzRound: boolean;
}
// Types
interface NzSkeletonAvatar {
size?: 'large' | 'small' | 'default' | number;
shape?: 'circle' | 'square';
}
interface NzSkeletonTitle {
width?: number | string;
}
interface NzSkeletonParagraph {
rows?: number;
width?: number | string | Array<number | string>;
}
// Module
class NzSkeletonModule {
static forRoot(): ModuleWithProviders<NzSkeletonModule>;
}Spin component for loading indicators.
/**
* Spin component
* Selector: nz-spin
*/
interface NzSpinComponent {
/** Spinning state */
nzSpinning: boolean;
/** Spin size */
nzSize: 'small' | 'default' | 'large';
/** Loading tip */
nzTip: string | null;
/** Custom indicator */
nzIndicator: TemplateRef<void> | null;
/** Delay before showing */
nzDelay: number;
/** Simple mode */
nzSimple: boolean;
}
// Module
class NzSpinModule {
static forRoot(): ModuleWithProviders<NzSpinModule>;
}