or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

data-display.mdform-controls.mdindex.mdlayout.mdnavigation.mdoverlay.mdservices.md
tile.json

tessl/npm-primeng

Comprehensive Angular UI component library with 80+ components for building modern web applications

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/primeng@20.1.x

To install, run

npx @tessl/cli install tessl/npm-primeng@20.1.0

index.mddocs/

PrimeNG

A comprehensive Angular UI component library providing 80+ components for building modern web applications.

Overview

PrimeNG is a feature-rich Angular UI library that offers a complete set of components for form controls, data display, navigation, layout, overlays, and utilities. Built with TypeScript and following Angular best practices, it supports both standalone components (Angular 14+) and traditional NgModule imports.

Installation

npm install primeng
npm install primeicons  # Optional: for built-in icons

Basic Setup

Global Configuration

import { bootstrapApplication } from '@angular/platform-browser';
import { providePrimeNG } from 'primeng/config';
import { AppComponent } from './app.component';

bootstrapApplication(AppComponent, {
  providers: [
    providePrimeNG({
      theme: {
        preset: 'Aura'
      }
    })
  ]
});

Component Import (Standalone)

import { Component } from '@angular/core';
import { Button } from 'primeng/button';
import { InputText } from 'primeng/inputtext';

@Component({
  selector: 'app-example',
  standalone: true,
  imports: [Button, InputText],
  template: `
    <input pInputText placeholder="Enter text" />
    <p-button label="Submit" />
  `
})
export class ExampleComponent {}

Module Import (Traditional)

import { NgModule } from '@angular/core';
import { ButtonModule } from 'primeng/button';
import { InputTextModule } from 'primeng/inputtext';

@NgModule({
  imports: [ButtonModule, InputTextModule],
  // ...
})
export class AppModule {}

Core Services

PrimeNG provides several global services for cross-component functionality:

// Core Services
class ConfirmationService {
  confirm(confirmation: Confirmation): void;
  close(): void;
}

class MessageService {
  add(message: Message): void;
  addAll(messages: Message[]): void;
  clear(key?: string): void;
}

class OverlayService {
  onShow: Subject<any>;
  onHide: Subject<any>;
}

class FilterService {
  filter(data: any[], fields: string[], filterValue: any, filterMatchMode: string): any[];
  filters: { [key: string]: (value: any, filter: any, filterLocale?: string) => boolean };
}

Core Interfaces

// Menu System
interface MenuItem {
  label?: string;
  icon?: string;
  command?: (event?: any) => void;
  url?: string;
  routerLink?: any;
  items?: MenuItem[];
  expanded?: boolean;
  disabled?: boolean;
  visible?: boolean;
  target?: string;
  separator?: boolean;
  badge?: string;
  badgeStyleClass?: string;
  style?: any;
  styleClass?: string;
  title?: string;
  id?: string;
}

// Selection System
interface SelectItem {
  label?: string;
  value: any;
  styleClass?: string;
  icon?: string;
  title?: string;
  disabled?: boolean;
}

interface SelectItemGroup {
  label: string;
  value?: any;
  items: SelectItem[];
}

// Tree Data
interface TreeNode {
  label?: string;
  data?: any;
  icon?: string;
  expandedIcon?: string;
  collapsedIcon?: string;
  children?: TreeNode[];
  leaf?: boolean;
  expanded?: boolean;
  type?: string;
  parent?: TreeNode;
  partialSelected?: boolean;
  styleClass?: string;
  draggable?: boolean;
  droppable?: boolean;
  selectable?: boolean;
  key?: string;
}

// Data Operations
interface LazyLoadEvent {
  first?: number;
  rows?: number;
  sortField?: string;
  sortOrder?: number;
  multiSortMeta?: SortMeta[];
  filters?: { [key: string]: FilterMetadata };
  globalFilter?: any;
  filterMatchModes?: { [key: string]: string };
}

interface SortMeta {
  field: string;
  order: number;
}

interface FilterMetadata {
  value?: any;
  matchMode?: string;
  operator?: string;
}

Template System

PrimeNG uses a powerful template system for component customization:

// Template Directives
@Directive({ selector: '[pTemplate]' })
class PrimeTemplate {
  name: string;
  type: string;
}

// Usage in components
@Component({
  template: `
    <p-table [value]="data">
      <ng-template pTemplate="header">
        <tr><th>Name</th><th>Age</th></tr>
      </ng-template>
      <ng-template pTemplate="body" let-item>
        <tr><td>{{item.name}}</td><td>{{item.age}}</td></tr>
      </ng-template>
    </p-table>
  `
})

Component Categories

The PrimeNG library is organized into logical categories:

  • Form Controls - Input components for data collection (21 components)
  • Data Display - Components for presenting data (11 components)
  • Navigation - Menu and navigation components (12 components)
  • Layout - Container and layout components (7 components)
  • Overlay - Modal and popup components (8 components)
  • Services - Global services and utilities

Icons

PrimeNG includes 200+ built-in icons through PrimeIcons:

// Icon Constants
const PrimeIcons = {
  ALIGN_CENTER: 'pi pi-align-center',
  ALIGN_JUSTIFY: 'pi pi-align-justify',
  ALIGN_LEFT: 'pi pi-align-left',
  ALIGN_RIGHT: 'pi pi-align-right',
  ARROW_DOWN: 'pi pi-arrow-down',
  ARROW_LEFT: 'pi pi-arrow-left',
  ARROW_RIGHT: 'pi pi-arrow-right',
  ARROW_UP: 'pi pi-arrow-up',
  CHECK: 'pi pi-check',
  TIMES: 'pi pi-times',
  PLUS: 'pi pi-plus',
  MINUS: 'pi pi-minus',
  SEARCH: 'pi pi-search',
  // ... 200+ more icons
};

Individual icon components are also available:

import { CheckIcon } from 'primeng/icons/check';
import { TimesIcon } from 'primeng/icons/times';
import { SearchIcon } from 'primeng/icons/search';

Configuration

interface PrimeNGConfigType {
  ripple?: boolean;
  inputStyle?: 'outlined' | 'filled';
  theme?: {
    preset?: string;
    options?: any;
  };
  translation?: Translation;
  filterMatchModeOptions?: {
    text: FilterMatchMode[];
    numeric: FilterMatchMode[];
    date: FilterMatchMode[];
  };
  zIndex?: ZIndex;
}

interface ZIndex {
  modal?: number;
  overlay?: number;
  menu?: number;
  tooltip?: number;
}

interface Translation {
  accept?: string;
  reject?: string;
  choose?: string;
  upload?: string;
  cancel?: string;
  clear?: string;
  // ... more translation keys
}

Theming

PrimeNG supports multiple theming approaches:

  1. CSS Variables - Runtime theme switching
  2. SASS Variables - Build-time customization
  3. Styled Mode - Component-specific styling
  4. Unstyled Mode - Bring your own styles

Accessibility

All components include:

  • ARIA attributes and roles
  • Keyboard navigation support
  • Screen reader compatibility
  • High contrast theme support
  • Focus management

Browser Support

  • Chrome 90+
  • Firefox 88+
  • Safari 14+
  • Edge 90+

License

MIT License - Free for commercial and personal use.