Get StartedPrimeNG is a rich set of open source native Angular UI components.

Download

PrimeNG is available at npm, if you have an existing application run the following command to download it to your project.

  1. npm install primeng --save
  2. npm install primeicons --save
  3.  

Load Configuration

PrimeNG is distributed in commonjs format, a module manager of your choice is required and this guide provides samples for SystemJS, WebPack and Angular CLI.

Import

UI components are configured as modules, once PrimeNG is downloaded and configured, modules and apis can be imported from 'primeng/*' shorthand in your application code. Documentation of each component states the import path.

  1. import {AccordionModule} from 'primeng/accordion'; //accordion and accordion tab
  2. import {MenuItem} from 'primeng/api'; //api
  3.  

Dependencies

Majority of PrimeNG components (95%) are native and there are some exceptions having 3rd party dependencies. In addition, components require PrimeIcons for icons.

The css dependencies are as follows, Prime Icons, theme of your choice and structural css of components.

  1. <link rel="stylesheet" type="text/css" href="/node_modules/primeicons/primeicons.css" />
  2. <link rel="stylesheet" type="text/css" href="/node_modules/primeng/resources/themes/nova-light/theme.css" />
  3. <link rel="stylesheet" type="text/css" href="/node_modules/primeng/resources/primeng.min.css" />
  4.  

Here is the list of components with 3rd party dependencies.

ComponentDependency
ScheduleFullCalendar 4.0.0-alpha.2
EditorQuill Editor
GMapGoogle Maps
ChartsCharts.js 2.7.x
CaptchaGoogle Recaptcha

Animations

Various components utilize angular animations to improve the user experience, starting with Angular 4 animations have their own module so you need to import BrowserAnimationsModule to your application. If you prefer to disable animations globally, import NoopAnimationsModule instead.

  1. npm install @angular/animations --save
  2.  
  1. import {BrowserModule} from '@angular/platform-browser';
  2. import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
  3. @NgModule({
  4. imports: [
  5. BrowserModule,
  6. BrowserAnimationsModule,
  7. //...
  8. ],
  9. //...
  10. })
  11. export class YourAppModule { }
  12.  

Angular CLI Integration

Angular CLI is the official CLI tool for Angular. We strongly suggest using Angular CLI when starting an Angular project.

Dependencies

Add PrimeNG and PrimeIcons as dependencies.

  1. "dependencies": {
  2. //...
  3. "primeng": "^7.0.0",
  4. "primeicons": "^1.0.0"
  5. },
  6.  

Styles Configuration

Configure required styles at the styles section, example below uses the Nova Light theme.

  1. "styles": [
  2. "node_modules/primeicons/primeicons.css",
  3. "node_modules/primeng/resources/themes/nova-light/theme.css",
  4. "node_modules/primeng/resources/primeng.min.css",
  5. //...
  6. ],
  7.  

That is all, you may now import PrimeNG components, for a working example visit the PrimeNG CLI QuickStart sample at GitHub.