### Basic Toolbar Usage
Source: https://v19.primeng.org/toolbar
A basic Toolbar example demonstrating the placement of content in start, center, and end sections.
```html
```
--------------------------------
### Install PrimeNG Packages
Source: https://v19.primeng.org/installation
Install PrimeNG and its themes using your preferred package manager.
```bash
npm install primeng @primeng/themes
```
```bash
yarn add primeng @primeng/themes
```
```bash
pnpm add primeng @primeng/themes
```
--------------------------------
### Advanced Dock with Desktop UI Example
Source: https://v19.primeng.org/dock
An advanced example demonstrating a mock desktop UI using various PrimeNG components, including the Dock. This snippet showcases the integration of Dock with Menubar, Dialog, Toast, and Galleria.
```html
Fri 13:07
```
--------------------------------
### Basic Galleria Setup
Source: https://v19.primeng.org/galleria
A basic Galleria setup requires a 'value' for images, an 'item' template for high-resolution images, and a 'thumbnail' template for thumbnails. Configure container styles and the number of visible thumbnails.
```html
```
--------------------------------
### Linear Stepper Example
Source: https://v19.primeng.org/stepper
Use the linear property set to true to enforce sequential step completion. This example demonstrates a three-step process with navigation buttons.
```html
Header IHeader IIHeader II
Content I
Content II
Content III
```
--------------------------------
### Install Chart.js
Source: https://v19.primeng.org/chart
Install the Chart.js package using npm. This is a prerequisite for using PrimeNG charts.
```bash
npm install chart.js --save
```
--------------------------------
### Custom Toolbar with Styling
Source: https://v19.primeng.org/toolbar
A custom Toolbar example with inline styles and content alignment using flexbox.
```html
```
--------------------------------
### Install PrimeIcons via npm
Source: https://v19.primeng.org/icons
Download the PrimeIcons library to your project using npm. This is the first step to integrating icons.
```bash
npm install primeicons
```
--------------------------------
### Basic ContextMenu Setup
Source: https://v19.primeng.org/contextmenu
Attach a ContextMenu to a specific element using the 'target' property. Ensure the target element has a local template variable defined.
```html
```
--------------------------------
### Basic Breadcrumb Setup
Source: https://v19.primeng.org/breadcrumb
A basic implementation of the PrimeNG Breadcrumb component using the 'items' and 'home' properties.
```html
```
--------------------------------
### Install Quill Dependency
Source: https://v19.primeng.org/editor
The PrimeNG Editor relies on the Quill editor, which needs to be installed as a separate dependency.
```bash
npm install quill
```
--------------------------------
### Basic Stepper with Custom Templates
Source: https://v19.primeng.org/stepper
Example of a Stepper component with custom content and navigation templates for each step. Use this for defining multi-step processes.
```html
Step 1
Account Information
Step 2
Personal Details
Step 3
Account created successfully
```
--------------------------------
### Drawer Accessibility with Trigger
Source: https://v19.primeng.org/drawer
Example demonstrating accessibility attributes for a Drawer trigger button and the Drawer itself. Ensure the trigger is keyboard-accessible.
```html
content
```
--------------------------------
### Basic Usage
Source: https://v19.primeng.org/iconfield
Demonstrates the basic setup of IconField by wrapping an input and an icon. The icon's position can be controlled with the `iconPosition` property, defaulting to 'right'.
```APIDOC
## Basic Usage
A group is created by wrapping the input and icon with the `p-iconfield` component. Each icon is defined as a child of `p-inputicon` component. In addition, position of the icon can be changed using `iconPosition` property that the default value is `right` and also `left` option is available.
```html
```
```
--------------------------------
### Using SelectOne with Animations
Source: https://v19.primeng.org/tailwind
Example of integrating the `p-select` component with animation classes for dynamic visual effects. Ensure the `dynamicAnimationClasses` are correctly bound to apply the selected animation.
```html
```
--------------------------------
### Basic Drawer Usage
Source: https://v19.primeng.org/drawer
A basic example of a Drawer component. Visibility is controlled by a binding to the `visible` property. A button is used to toggle the drawer's visibility.
```html
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore
et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat.
```
--------------------------------
### Outlined SplitButton Examples
Source: https://v19.primeng.org/splitbutton
Configure SplitButtons with an outlined style, featuring a border without an initial background. Supports different severity levels.
```html
```
--------------------------------
### List Skeleton Layout
Source: https://v19.primeng.org/skeleton
Create a skeleton placeholder for a list. This example demonstrates using skeletons to represent list items, including circular avatars and text placeholders.
```html
```
--------------------------------
### Sample InputOtp Implementation with Templating
Source: https://v19.primeng.org/inputotp
A sample UI implementation demonstrating the use of templating within InputOtp, along with additional elements like buttons and icons.
```html
Authenticate Your Account
Please enter the code sent to your phone.
```
--------------------------------
### Basic ConfirmPopup Usage
Source: https://v19.primeng.org/confirmpopup
Use the p-confirmPopup tag and an instance of ConfirmationService to display a confirmation overlay. This example shows basic save and delete buttons triggering confirmations.
```html
```
--------------------------------
### Sample Implementation
Source: https://v19.primeng.org/inputotp
A sample UI implementation showcasing templating and additional elements for a complete user experience.
```APIDOC
## Sample
A sample UI implementation with templating and additional elements.
```html
Authenticate Your Account
Please enter the code sent to your phone.
```
```
--------------------------------
### Splitter with Custom Panel Sizes
Source: https://v19.primeng.org/splitter
Configure relative widths for panels using the `panelSizes` property. Example: [25, 75] splits the available space into 25% and 75%.
```html
Panel 1
Panel 2
```
--------------------------------
### FilterService Usage Examples
Source: https://v19.primeng.org/filterservice
Inject FilterService into your component and use its methods for filtering. Examples include equals, contains, startsWith, endsWith, lt, gt, and in.
```typescript
export class FilterServiceDemo implements OnInit {
constructor(private filterService: FilterService) {}
ngOnInit() {
const value = 'PrimeNG';
this.filterService.filters.equals(value, 'NG'); //false
this.filterService.filters.equals(value, 8); //false
this.filterService.filters.equals(value, new Date()); //false
this.filterService.filters.contains(value, 'NG'); //true
this.filterService.filters.startsWith(value, 'NG'); //false
this.filterService.filters.endsWith(value, 'NG'); //true
this.filterService.filters.lt(10, 20); //true
this.filterService.filters.gt(50, 20); //true
this.filterService.filters.in(value, ['PrimeFaces', 'PrimeNG']); //true
}
}
```
--------------------------------
### Basic Steps Configuration
Source: https://v19.primeng.org/steps
Configure the Steps component using a collection of menu items for the 'model' property.
```html
```
--------------------------------
### Install tailwindcss-primeui Plugin
Source: https://v19.primeng.org/tailwind
Install the official PrimeTek plugin for seamless integration between PrimeNG and Tailwind CSS. This package includes both CSS and JS versions for compatibility with Tailwind v4 and v3 respectively.
```bash
npm i tailwindcss-primeui
```
--------------------------------
### Basic InputNumber Examples
Source: https://v19.primeng.org/inputnumber
Demonstrates different InputNumber configurations for integer-only input, decimal input without grouping, and input with specified minimum and maximum fraction digits and boundaries.
```html
```
--------------------------------
### Headless Drawer Implementation
Source: https://v19.primeng.org/drawer
Example of implementing a fully customizable drawer using headless mode. This involves defining the entire UI structure within the template, including headers, navigation, and interactive elements.
```html
Revenue
```
--------------------------------
### Headless Dialog Example
Source: https://v19.primeng.org/dialog
Demonstrates a fully customizable dialog UI using headless mode. This approach allows complete control over the dialog's appearance and content, overriding default elements.
```html
```
--------------------------------
### Render Button Component
Source: https://v19.primeng.org/installation
Example of how to use the PrimeNG Button component in your template.
```html
```
--------------------------------
### Toolbar Accessibility with aria-label
Source: https://v19.primeng.org/toolbar
Example of setting an aria-label on the Toolbar for screen reader accessibility.
```html
Content
```
--------------------------------
### ScrollPanel Component Usage
Source: https://v19.primeng.org/scrollpanel
Example of how to use the p-scrollpanel component with basic content and styling.
```APIDOC
## p-scrollpanel
### Description
ScrollPanel is a cross browser, lightweight and themable alternative to native browser scrollbar.
### Properties
- **style** (object) - Inline style of the component.
- **styleClass** (string) - Style class of the component.
- **step** (number) - Step factor to scroll the content while pressing the arrow keys. Default: 5
### Methods
- **scrollTop**(scrollTop: number): Scrolls the top location to the given value.
- **refresh**(): Refreshes the position and size of the scrollbar.
### Example Usage
```html
Lorem ipsum dolor sit amet, consectetur adipiscing elit...
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium...
At vero eos et accusamus et iusto odio dignissimos...
```
```
--------------------------------
### Table Integration
Source: https://v19.primeng.org/contextmenu
ContextMenu has built-in support for integration with tables. Refer to the ContextMenu demo for an example.
```APIDOC
## Table
Table has built-in support for ContextMenu, see the ContextMenu demo for an example.
```
--------------------------------
### Raised SplitButton Examples
Source: https://v19.primeng.org/splitbutton
Display SplitButtons with a raised appearance for elevation. Various severity levels can be applied.
```html
```
--------------------------------
### Native Checkbox Example
Source: https://v19.primeng.org/guides/accessibility
A standard HTML checkbox element with built-in keyboard and screen reader support.
```html
```
--------------------------------
### Provide PrimeNG Configuration
Source: https://v19.primeng.org/configuration
Define the initial configuration for PrimeNG during application startup using the providePrimeNG provider.
```typescript
import { ApplicationConfig } from '@angular/core';
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
import { providePrimeNG } from 'primeng/config';
export const appConfig: ApplicationConfig = {
providers: [
provideAnimationsAsync(),
providePrimeNG({ /* options */ })
]
};
```
--------------------------------
### Basic Steps
Source: https://v19.primeng.org/steps
A basic implementation of the Steps component requires a collection of menu items for its model.
```APIDOC
## Basic
Steps requires a collection of menuitems as its _model_.
```html
```
```
--------------------------------
### Knob with Reactive Forms
Source: https://v19.primeng.org/knob
Shows how to use the Knob component within a reactive forms setup using formControlName.
```APIDOC
## Reactive Forms
Knob can also be used with reactive forms. In this case, the _formControlName_ property is used to bind the component to a form control.
```html
```
```
--------------------------------
### Responsive Form Layout with PrimeNG and Tailwind CSS
Source: https://v19.primeng.org/tailwind
Example demonstrating a responsive form layout using PrimeNG components and Tailwind CSS utility classes for styling and spacing.
```html
```
--------------------------------
### TreeTable with Localized Pagination
Source: https://v19.primeng.org/treetable
Configures pagination for the TreeTable with a specific locale using the _paginatorLocale_ property. This example sets the locale to 'fa-IR'.
```html
{{ col.header }}
{{ rowData[col.field] }}
```
--------------------------------
### Tag with Templated Content
Source: https://v19.primeng.org/tag
Customize the tag's content using template syntax. This example shows how to include an image and text.
```html
Italy
```
--------------------------------
### Galleria with Custom Indicator Template
Source: https://v19.primeng.org/galleria
Customize the content of indicators by using the 'indicator' template. This example displays the index number for each indicator.
```html
{{ index + 1 }}
```
--------------------------------
### Horizontal Stepper Example
Source: https://v19.primeng.org/stepper
A basic horizontal stepper implementation with three steps. Use the 'value' property to bind steps and panels. Navigation between steps is handled by the 'activateCallback' function.
```html
Header IHeader IIHeader II
Content I
Content II
Content III
```
--------------------------------
### Basic ConfirmPopup Usage
Source: https://v19.primeng.org/confirmpopup
Demonstrates the basic implementation of ConfirmPopup using the ConfirmationService.
```APIDOC
## Basic
ConfirmPopup displays a confirmation overlay displayed relatively to its target. An instance of ConfirmationService is required to display it by calling the confirm method.
```html
```
```
--------------------------------
### IconField with IftaLabel
Source: https://v19.primeng.org/iconfield
IftaLabel is used to create infield top-aligned labels. This example demonstrates integrating IconField within an IftaLabel component.
```html
```
--------------------------------
### InputOtp Sizes
Source: https://v19.primeng.org/inputotp
Shows how to apply different sizes (small, base, large) to the InputOtp component.
```html
```
--------------------------------
### Register Custom Constraint
Source: https://v19.primeng.org/filterservice
Extend FilterService by registering a new custom constraint function. This example shows how to add an 'isPrimeNumber' constraint.
```typescript
this.filterService.register('isPrimeNumber', (value, filter): boolean => {
if (filter === undefined || filter === null || filter.trim() === '') {
return true;
}
if (value === undefined || value === null) {
return false;
}
return value.toString() === filter.toString();
});
this.filterService.filters['isPrimeNumber'](3); //true
this.filterService.filters['isPrimeNumber'](5); //true
this.filterService.filters['isPrimeNumber'](568985673); //false
```