### Install Project Dependencies
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/README.md
Install the necessary Python libraries listed in requirements.txt.
```bash
pip install -r requirements.txt
```
--------------------------------
### Install PrimeVue and Themes
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
Install PrimeVue and its associated themes using npm, yarn, or pnpm.
```bash
# Using npm
npm install primevue @primeuix/themes
# Using yarn
yarn add primevue @primeuix/themes
# Using pnpm
pnpm add primevue @primeuix/themes
```
--------------------------------
### Install PrimeCLT
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
Installs the PrimeCLT command line utility globally using npm.
```bash
npm install -g primeclt
```
--------------------------------
### Install PrimeVue and PrimeIcons
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/_autodocs/TECHNICAL_REFERENCE.md
Install PrimeVue and PrimeIcons using npm. These are the initial steps for setting up PrimeVue in your project.
```bash
npm install primevue
npm install primeicons
```
--------------------------------
### Basic Accordion Example
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
A basic Accordion setup with three AccordionPanels. Each panel requires a unique 'value' property for identification and state management.
```html
Header I
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. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Header II
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim
ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Consectetur, adipisci velit, sed quia non numquam eius modi.
Header III
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa
qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus.
```
--------------------------------
### Complete PrimeVue v4 Configuration Example
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/_autodocs/configuration.md
A full example demonstrating how to set up PrimeVue v4 in a Vue application, including theme, icons, presets, and services.
```typescript
// main.ts
import { createApp } from 'vue';
import PrimeVue from 'primevue/config';
import App from './App.vue';
// Theme & Icons
import 'primevue/resources/themes/lara-light-blue/theme.css';
import 'primevue/resources/primevue.css';
import 'primevue/icons/primeicons.css';
// Tailwind (optional)
import Tailwind from 'primevue/presets/tailwind';
const app = createApp(App);
app.use(PrimeVue, {
locale: 'en',
ripple: true,
zIndex: {
modal: 1100,
overlay: 1000,
dropdown: 1000,
tooltip: 1100,
toast: 1050
},
pt: Tailwind,
unstyled: false
});
// Provide services
import { useToast } from 'primevue/usetoast';
import { useConfirm } from 'primevue/useconfirm';
import { useDynamicDialog } from 'primevue/usedynamicdialog';
app.provide('toast', useToast());
app.provide('confirm', useConfirm());
app.provide('dialog', useDynamicDialog());
app.mount('#app');
```
--------------------------------
### Install PrimeVue with Nuxt using pnpm
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
Install PrimeVue, themes, and the Nuxt module using pnpm.
```bash
pnpm add primevue @primeuix/themes
pnpm add -D @primevue/nuxt-module
```
--------------------------------
### Install PrimeVue with Nuxt using npm
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
Install PrimeVue, themes, and the Nuxt module using npm.
```bash
npm install primevue @primeuix/themes
npm install --save-dev @primevue/nuxt-module
```
--------------------------------
### Custom Pass Through Configuration Example
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
Example of a custom Pass Through configuration file defining root and other element styles for a button.
```javascript
const MyCustomPT = {
...
button: {
root: 'my-button',
...
},
...
}
export default MyCustomPT;
```
--------------------------------
### Install PrimeVue with Nuxt using yarn
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
Install PrimeVue, themes, and the Nuxt module using yarn.
```bash
yarn add primevue @primeuix/themes
yarn add --dev @primevue/nuxt-module
```
--------------------------------
### Run Showcase Locally
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
Install dependencies and run the PrimeVue showcase in your local environment.
```bash
npm run setup
npm run dev
```
--------------------------------
### Complete PrimeVue CDN Example with DatePicker
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
A full HTML example demonstrating PrimeVue integration via CDN, including Vue, PrimeVue, a theme, and a DatePicker component. The example shows how to set up the app, use the plugin with theme configuration, and register components.
```html
PrimeVue + CDN
{{ date }}
```
--------------------------------
### Install Auto Import Packages
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
Install the necessary packages for automatic component import resolution as development dependencies.
```bash
npm i unplugin-vue-components -D
npm i @primevue/auto-import-resolver -D
```
--------------------------------
### Install ConfirmationService
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
Install the ConfirmationService as an application plugin to manage ConfirmDialog instances. This is required for the service to function.
```javascript
import {createApp} from 'vue';
import ConfirmationService from 'primevue/confirmationservice';
const app = createApp(App);
app.use(ConfirmationService);
```
--------------------------------
### Basic ProgressSpinner Example
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
Display a default ProgressSpinner with an infinite spin animation.
```html
```
--------------------------------
### DynamicDialog Example
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
Demonstrates how to show a dialog for product selection using DynamicDialog and a Button.
```vue
```
--------------------------------
### Install PrimeIcons
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
Download the PrimeIcons library using npm.
```bash
npm install primeicons
```
--------------------------------
### Install PrimeVue Forms Add-on
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
Install the PrimeVue Forms add-on using npm, yarn, or pnpm.
```bash
# Using npm
npm install @primevue/forms
# Using yarn
yarn add @primevue/forms
# Using pnpm
pnpm add @primevue/forms
```
--------------------------------
### Install Tailwind CSS PrimeUI Plugin
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
Install the official PrimeTek plugin for PrimeVue and Tailwind CSS integration.
```bash
npm i tailwindcss-primeui
```
--------------------------------
### Configure Initial Theme with Preset
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
Sets the initial theme for PrimeVue using a preset and custom options. Ensure PrimeVue is installed and imported.
```javascript
import PrimeVue from 'primevue/config';
import Aura from '@primeuix/themes/aura';
const app = createApp(App);
app.use(PrimeVue, {
// Default theme configuration
theme: {
preset: Aura,
options: {
prefix: 'p',
darkModeSelector: 'system',
cssLayer: false
}
}
});
```
--------------------------------
### Install Quill Dependency
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
Installs Quill, the underlying rich text editor library, as a project dependency.
```bash
npm install quill
```
--------------------------------
### Headless Drawer with Submenu Example
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
This example shows a headless Drawer with a collapsible submenu. It uses PrimeFlex classes for styling and v-styleclass to manage the visibility and animation of the submenu content. The main menu item includes an icon and text, with a nested list for submenu options.
```html
```
--------------------------------
### Pie Chart Example
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
Render a pie chart by setting the 'type' property to 'pie'. Includes CSS classes for sizing.
```html
```
--------------------------------
### ConfirmDialog Headless Mode Example
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
Implement a fully custom confirmation UI using the 'container' slot in headless mode. This example demonstrates a custom dialog with header, message, and action buttons.
```html
{{ message.header }}
{{ message.message }}
```
--------------------------------
### Form State Example
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
An example JSON object representing the state of a form, showing its validity. This is typically displayed within a `
` tag for readability.
```json
{
"valid": true
}
```
--------------------------------
### Basic Toolbar Usage
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
Demonstrates a basic Toolbar with content placed in the start, center, and end slots. The start slot contains buttons, the center slot includes a search input, and the end slot features a save button.
```html
```
--------------------------------
### Vertical Splitter Example
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
Create a vertical Splitter by setting the 'layout' property to 'vertical'. Panels will be stacked.
```html
Panel 1 Panel 2
```
--------------------------------
### Headless Drawer Structure Example
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
This example demonstrates the basic HTML structure for a headless Drawer component. It utilizes PrimeVue's v-ripple and v-styleclass directives for interactive elements and dynamic class management. The structure includes nested lists for navigation items, with icons and text, and a badge for unread messages.
```html
```
--------------------------------
### Basic Animation Example
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
Demonstrates how to apply animations to an element using the 'animation' and 'animate-duration' classes. Requires a Select component and an array of animation options.
```vue
```
--------------------------------
### Initialize PrimeVue Plugin
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/_autodocs/configuration.md
Install PrimeVue as a Vue plugin during application initialization. This is the primary step to enable PrimeVue's features.
```typescript
import { createApp } from 'vue';
import PrimeVue from 'primevue/config';
import App from './App.vue';
const app = createApp(App);
app.use(PrimeVue, {
// configuration options
});
app.mount('#app');
```
--------------------------------
### Horizontal Splitter Example
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
A basic horizontal Splitter with two panels. Panels are displayed side-by-side by default.
```html
Panel 1 Panel 2
```
--------------------------------
### Line Chart Example
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
Display a line chart by setting the 'type' property to 'line'. CSS class applied for height.
```html
```
--------------------------------
### DialogService Installation
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
Install the DialogService as a Vue application plugin to enable dynamic dialog functionality. This is typically done during application setup.
```javascript
import {createApp} from 'vue';
import DialogService from 'primevue/dialogservice';
const app = createApp(App);
app.use(DialogService);
```
--------------------------------
### Set Up Python Virtual Environment
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/README.md
Create and activate a virtual environment to manage project dependencies.
```bash
python3 -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
```
--------------------------------
### Customize PrimeVue Preset
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
Use definePreset to customize an existing PrimeVue preset by overriding design tokens during application setup. This example shows how to import necessary modules and apply a custom preset.
```javascript
import PrimeVue from 'primevue/config';
import { definePreset } from '@primeuix/themes';
import Aura from '@primeuix/themes/aura';
const MyPreset = definePreset(Aura, {
//Your customizations, see the following sections for examples
});
app.use(PrimeVue, {
theme: {
preset: MyPreset
}
});
```
--------------------------------
### Basic TieredMenu Usage
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
A basic example of rendering a TieredMenu with a defined set of items. Ensure you have a Toast component available for potential feedback.
```html
```
--------------------------------
### InputOtp Sample UI with Templating
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
A comprehensive example demonstrating InputOtp with a custom template, including length configuration, conditional elements within the template, and integrated buttons for actions like resending or submitting codes.
```html
Authenticate Your Account
Please enter the code sent to your phone.
```
--------------------------------
### Install Chart.js Dependency
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
The Chart component requires Chart.js to be installed as a project dependency.
```bash
npm install chart.js
```
--------------------------------
### Install Toast Service
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
Install the ToastService as a Vue application plugin to enable toast message functionality.
```javascript
import {createApp} from 'vue';
import ToastService from 'primevue/toastservice';
const app = createApp(App);
app.use(ToastService);
```
--------------------------------
### Create Vue App with CDN
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
Set up a basic Vue application using Vue.js from a CDN and mount it to an HTML element. This example demonstrates the minimal structure for a CDN-based Vue app.
```html
```
--------------------------------
### Using useConfirm for Dialog Logic
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
This script setup demonstrates how to use the useConfirm composable to programmatically open the ConfirmDialog, including handling show and hide events to manage component visibility.
```javascript
const confirm = useConfirm();
const isVisible = ref(false);
const openDialog = () => {
confirm.require({
message: 'Are you sure you want to proceed?',
header: 'Confirmation',
onShow: () => {
isVisible.value = true;
},
onHide: () => {
isVisible.value = false;
}
});
};
```
--------------------------------
### Basic Select Usage
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/_autodocs/api-reference/select.md
Demonstrates the basic setup of the Select component with options and v-model binding. Ensure the 'ref' function is imported from 'vue' for reactive data.
```vue
```
--------------------------------
### Install unplugin-vue-components for Vite
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/_autodocs/configuration.md
Install the necessary plugin for Vite to enable component auto-import. This is a prerequisite for the Vite configuration.
```bash
npm install -D unplugin-vue-components
```
--------------------------------
### ConfirmDialog Templating Example
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
Customize the message content of the ConfirmDialog using the 'message' slot. This example shows how to display an icon and a message within the dialog.
```html
{{ slotProps.message.message }}
```
--------------------------------
### TypeScript Component Props Example
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/_autodocs/TECHNICAL_REFERENCE.md
PrimeVue components are fully typed with TypeScript. This example shows how to use component-specific props types for type-safe props.
```typescript
import Button, { type ButtonProps } from 'primevue/button';
// Type-safe props
const props: ButtonProps = {
label: 'Click me',
severity: 'success',
disabled: false
};
```
--------------------------------
### Basic ContextMenu Usage
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
Implement a basic ContextMenu attached to an image. The menu is displayed by explicitly calling the 'show' method on a 'contextmenu' event.
```html
```
--------------------------------
### Drawer Accessibility Example
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
Example demonstrating accessibility attributes for the Drawer component's trigger and root elements. Ensure 'aria-controls' and 'aria-expanded' are managed for the trigger, and 'role' and 'aria-modal' are set for the drawer.
```vue
Content
```
--------------------------------
### Basic DataView List Layout
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
Displays a list of products using the DataView component. Requires a 'value' prop for data and a 'list' slot for item templating. The example shows how to render product images, names, prices, and action buttons.
```html
{{ item.category }}
{{ item.name }}
{{ item.rating }}
$
{{ item.price }}
```
--------------------------------
### Accessible Dialog Example
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/_autodocs/api-reference/dialog.md
An example of an accessible Dialog component with proper ARIA attributes for screen readers and keyboard navigation. Ensure the `header` slot content includes an `id` that matches the `aria-labelledby` attribute.
```vue
```
--------------------------------
### Headless Drawer Implementation
Source: https://github.com/navidb/primevue-v4-markdown-docs/blob/main/primevue_v4_docs.md
Example of enabling headless mode for the Drawer component by utilizing the 'container' slot to implement custom UI elements and interactions.
```html