Convert Figma logo to code with AI

NG-ZORRO logong-zorro-antd

Angular UI Component Library based on Ant Design

8,850
3,901
8,850
907

Top Related Projects

An enterprise-class UI design language and React UI library

10,152

The Most Complete Angular UI Component Library

Component infrastructure and Material Design components for Angular

6,431

Clarity is a scalable, accessible, customizable, open source design system built with web components. Works with any JavaScript framework, built for enterprises, and designed to be inclusive.

8,046

:boom: Customizable Angular UI Library based on Eva Design System :new_moon_with_face::sparkles:Dark Mode

Fast and reliable Bootstrap widgets in Angular (supports Ivy engine)

Quick Overview

NG-ZORRO/ng-zorro-antd is an enterprise-class UI component library for Angular applications, based on Ant Design. It provides a comprehensive set of high-quality components and demos for building rich, interactive user interfaces with Angular.

Pros

  • Extensive collection of pre-built, customizable components
  • Follows Ant Design specifications for consistent and modern UI
  • Excellent TypeScript support and Angular integration
  • Active community and regular updates

Cons

  • Learning curve for developers unfamiliar with Ant Design principles
  • Large bundle size if importing the entire library
  • Some components may have limited customization options
  • Occasional breaking changes between major versions

Code Examples

  1. Basic Button Component:
import { NzButtonModule } from 'ng-zorro-antd/button';

@Component({
  selector: 'app-button-demo',
  template: `
    <button nz-button nzType="primary">Primary Button</button>
  `
})
export class ButtonDemoComponent {}
  1. Form with Validation:
import { NzFormModule } from 'ng-zorro-antd/form';

@Component({
  selector: 'app-form-demo',
  template: `
    <form nz-form [formGroup]="validateForm" (ngSubmit)="submitForm()">
      <nz-form-item>
        <nz-form-control nzErrorTip="Please input your username!">
          <input nz-input formControlName="userName" placeholder="Username">
        </nz-form-control>
      </nz-form-item>
      <button nz-button nzType="primary">Submit</button>
    </form>
  `
})
export class FormDemoComponent {
  validateForm: FormGroup;

  constructor(private fb: FormBuilder) {
    this.validateForm = this.fb.group({
      userName: [null, [Validators.required]]
    });
  }

  submitForm(): void {
    if (this.validateForm.valid) {
      console.log('submit', this.validateForm.value);
    } else {
      Object.values(this.validateForm.controls).forEach(control => {
        if (control.invalid) {
          control.markAsDirty();
          control.updateValueAndValidity({ onlySelf: true });
        }
      });
    }
  }
}
  1. Modal Dialog:
import { NzModalModule } from 'ng-zorro-antd/modal';

@Component({
  selector: 'app-modal-demo',
  template: `
    <button nz-button (click)="showModal()">Open Modal</button>
    <nz-modal [(nzVisible)]="isVisible" nzTitle="Modal Title" (nzOnCancel)="handleCancel()" (nzOnOk)="handleOk()">
      <p>Modal Content</p>
    </nz-modal>
  `
})
export class ModalDemoComponent {
  isVisible = false;

  showModal(): void {
    this.isVisible = true;
  }

  handleOk(): void {
    console.log('OK clicked');
    this.isVisible = false;
  }

  handleCancel(): void {
    console.log('Cancel clicked');
    this.isVisible = false;
  }
}

Getting Started

  1. Install NG-ZORRO:

    ng add ng-zorro-antd
    
  2. Import the module in your app.module.ts:

    import { NzButtonModule } from 'ng-zorro-antd/button';
    
    @NgModule({
      imports: [
        NzButtonModule
      ]
    })
    export class AppModule { }
    
  3. Use the components in your templates:

    <button nz-button nzType="primary">Primary Button</button>
    

Competitor Comparisons

An enterprise-class UI design language and React UI library

Pros of ant-design

  • Larger community and more contributors, leading to faster development and issue resolution
  • More comprehensive documentation and examples
  • Supports React Native, enabling mobile app development

Cons of ant-design

  • Steeper learning curve due to more complex API and extensive features
  • Larger bundle size, which may impact initial load times
  • Less flexibility for customization compared to ng-zorro-antd

Code Comparison

ng-zorro-antd (Angular):

import { NzButtonModule } from 'ng-zorro-antd/button';

@NgModule({
  imports: [NzButtonModule],
})
export class AppModule { }

ant-design (React):

import { Button } from 'antd';

function App() {
  return <Button type="primary">Click me</Button>;
}

Both libraries offer similar components and functionality, but ng-zorro-antd is specifically designed for Angular applications, while ant-design is primarily for React. The code structure differs due to the frameworks they support, with ng-zorro-antd using Angular's module system and ant-design utilizing React's component-based approach.

10,152

The Most Complete Angular UI Component Library

Pros of PrimeNG

  • More extensive component library with a wider range of UI elements
  • Better documentation and examples for each component
  • Stronger community support and more frequent updates

Cons of PrimeNG

  • Larger bundle size due to the extensive component library
  • Steeper learning curve for beginners due to the number of options and configurations
  • Less consistent with Material Design principles compared to ng-zorro-antd

Code Comparison

PrimeNG Button:

<p-button label="Click me" icon="pi pi-check" iconPos="right"></p-button>

ng-zorro-antd Button:

<button nz-button nzType="primary" nzShape="round">
  <i nz-icon nzType="search"></i>Search
</button>

Both libraries offer similar functionality, but PrimeNG tends to use more attributes for configuration, while ng-zorro-antd relies on directives and nested elements. PrimeNG's approach may be more intuitive for some developers, while ng-zorro-antd's structure aligns more closely with Angular's component-based architecture.

Component infrastructure and Material Design components for Angular

Pros of Angular Components

  • Official Angular Material library with extensive documentation and community support
  • Seamless integration with Angular framework and ecosystem
  • Consistent design language following Material Design principles

Cons of Angular Components

  • Limited set of components compared to ng-zorro-antd
  • Less customization options for theming and styling
  • Steeper learning curve for developers new to Material Design

Code Comparison

Angular Components:

import { MatButtonModule } from '@angular/material/button';

@NgModule({
  imports: [MatButtonModule],
})
export class AppModule { }

ng-zorro-antd:

import { NzButtonModule } from 'ng-zorro-antd/button';

@NgModule({
  imports: [NzButtonModule],
})
export class AppModule { }

Both libraries offer modular imports, but ng-zorro-antd provides more granular control over component imports. Angular Components follows Material Design guidelines, while ng-zorro-antd is based on Ant Design, offering a different visual style and component set.

ng-zorro-antd provides a wider range of components and more extensive customization options, making it suitable for complex enterprise applications. However, Angular Components benefits from being the official Material Design implementation for Angular, ensuring better long-term support and compatibility with the framework.

6,431

Clarity is a scalable, accessible, customizable, open source design system built with web components. Works with any JavaScript framework, built for enterprises, and designed to be inclusive.

Pros of Clarity

  • More comprehensive design system with extensive documentation
  • Better accessibility features and compliance with WCAG guidelines
  • Stronger focus on enterprise-level applications and scalability

Cons of Clarity

  • Steeper learning curve due to its more complex architecture
  • Less frequent updates and potentially slower adoption of new features
  • Smaller community compared to ng-zorro-antd, which may result in fewer third-party resources

Code Comparison

Clarity Button:

<button class="btn btn-primary">Primary Button</button>

ng-zorro-antd Button:

<button nz-button nzType="primary">Primary Button</button>

Both libraries offer similar functionality, but Clarity uses CSS classes for styling, while ng-zorro-antd uses Angular directives. This difference in approach is consistent throughout the libraries, with Clarity relying more on traditional HTML and CSS patterns, and ng-zorro-antd leveraging Angular's capabilities for a more tightly integrated experience.

Overall, Clarity is better suited for large-scale enterprise applications with strict accessibility requirements, while ng-zorro-antd offers a more lightweight and flexible solution for a wider range of projects. The choice between the two depends on the specific needs of your project and team preferences.

8,046

:boom: Customizable Angular UI Library based on Eva Design System :new_moon_with_face::sparkles:Dark Mode

Pros of Nebular

  • More customizable and flexible UI components
  • Includes additional features like authentication and security modules
  • Better suited for complex, enterprise-level applications

Cons of Nebular

  • Smaller community and less frequent updates compared to ng-zorro-antd
  • Steeper learning curve for developers new to the framework
  • Fewer pre-built components available out of the box

Code Comparison

ng-zorro-antd:

import { NzButtonModule } from 'ng-zorro-antd/button';

@NgModule({
  imports: [ NzButtonModule ]
})
export class AppModule { }

Nebular:

import { NbButtonModule } from '@nebular/theme';

@NgModule({
  imports: [ NbButtonModule ]
})
export class AppModule { }

Both libraries offer similar component usage, but Nebular's components are prefixed with 'Nb' instead of 'Nz'. The main difference lies in the overall structure and additional features provided by each library, rather than in the basic component implementation.

Fast and reliable Bootstrap widgets in Angular (supports Ivy engine)

Pros of ngx-bootstrap

  • Lighter weight and more focused on core Bootstrap components
  • Easier integration with existing Bootstrap-based projects
  • More frequent updates and active community support

Cons of ngx-bootstrap

  • Limited set of components compared to ng-zorro-antd
  • Less comprehensive documentation and examples
  • Lacks some advanced features and customization options

Code Comparison

ngx-bootstrap:

<button type="button" class="btn btn-primary" 
        tooltip="Vivamus sagittis lacus vel augue laoreet rutrum faucibus.">
  Simple demo
</button>

ng-zorro-antd:

<button nz-button nzType="primary" nz-tooltip 
        nzTooltipTitle="Vivamus sagittis lacus vel augue laoreet rutrum faucibus.">
  Simple demo
</button>

Both libraries offer similar functionality, but ng-zorro-antd uses custom attributes (nz-*) for configuration, while ngx-bootstrap relies more on standard Bootstrap classes and attributes.

ngx-bootstrap is a good choice for projects already using Bootstrap or requiring a lightweight solution. ng-zorro-antd offers a more comprehensive set of components and advanced features, making it suitable for larger, more complex applications that need a complete UI framework.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

NG-ZORRO

An enterprise-class Angular UI component library based on Ant Design.

Azure branch CodeFactor Codecov GitHub Release Date npm package NPM downloads GitHub license Discord extension-for-VSCode code style: prettier Twitter

English | 简体中文

✨ Features

  • An enterprise-class UI design system for Angular applications.
  • 60+ high-quality Angular components out of the box.
  • Written in TypeScript with predictable static types.
  • The whole package of development and design resources and tools.
  • Support OnPush mode, high performance.
  • Powerful theme customization in every detail.
  • Internationalization support for dozens of languages.

☀️ License

MIT

FOSSA Status

🖥 Environment Support

Edge
Edge
Firefox
Firefox
Chrome
Chrome
Safari
Safari
Opera
Opera
Electron
Electron
last 2 versionslast 2 versionslast 2 versionslast 2 versionslast 2 versionslast 2 versions

🎨 Design Specification

ng-zorro-antd synchronizes design specification with Ant Design on a regular basis, you can check the log online.

📦 Installation

We recommend using @angular/cli to install. It not only makes development easier, but also allows you to take advantage of the rich ecosystem of angular packages and tooling.

$ ng new PROJECT_NAME
$ cd PROJECT_NAME
$ ng add ng-zorro-antd

More information about @angular/cli here.

You can also install ng-zorro-antd with npm or yarn

$ npm install ng-zorro-antd

🔨 Usage

Import the component modules you want to use into your app.module.ts file and feature modules.

import { NzButtonModule } from 'ng-zorro-antd/button';

@NgModule({
  imports: [ NzButtonModule ]
})
export class AppModule {
}

@angular/cli users won't have to worry about the things below but it's good to know.

And import style and SVG icon assets file link in angular.json.

{
  "assets": [
+   {
+     "glob": "**/*",
+     "input": "./node_modules/@ant-design/icons-angular/src/inline-svg/",
+     "output": "/assets/"
+   }
  ],
  "styles": [
+   "node_modules/ng-zorro-antd/ng-zorro-antd.min.css"
  ]
}

See Getting Started for more details.

🔗 Links

⌨️ Development

$ git clone git@github.com:NG-ZORRO/ng-zorro-antd.git
$ cd ng-zorro-antd
$ npm install
$ npm run start

Browser would open automatically.

🤝 Contributing

PRs Welcome

We welcome all contributions. Please read our CONTRIBUTING.md first. You can submit any ideas as pull requests or as GitHub issues.

If you're new to posting issues, we ask that you read How To Ask Questions The Smart Way (This guide does not provide actual support services for this project!), How to Ask a Question in Open Source Community and How to Report Bugs Effectively prior to posting. Well written bug reports help us help you!

Thanks to JetBrains for supporting us free open source licenses.

JetBrains

❓ Help from the Community

For questions on how to use ng-zorro-antd, please post questions to Stack Overflow using the ng-zorro-antd tag. If you're not finding what you need on stackoverflow, you can find us on Discord as well.

As always, we encourage experienced users to help those who are not familiar with ng-zorro-antd!

🎉 Users

We list some users here, if your company or product uses NG-ZORRO, let us know here!

Love ng-zorro-antd? Give our repo a star :star: :arrow_up:.

NPM DownloadsLast 30 Days