Configuration

Application widget configuration for PrimeVue.

Configuration is managed by the PrimeVue instance imported from primevue/config.


import PrimeVue from 'primevue/config';
const app = createApp(App);

app.use(PrimeVue, { /* options */ });

Style mode offers theming based on a design token based architecture. See the styled mode documentation for details such as building your own theme.


import PrimeVue from 'primevue/config';
import Aura from '@primevue/themes/aura';

const app = createApp(App);

app.use(PrimeVue, {
    theme: {
        preset: Aura,
        options: {
            prefix: 'p',
            darkModeSelector: 'system',
            cssLayer: false
        }
    }
 });

Unstyled mode instructs the components not to add any built-in style classes so that they can be styled using custom css or libraries like Tailwind, Bootstrap or PrimeFlex. Visit Unstyled mode documentation for more information.


import { createApp } from "vue";
import PrimeVue from "primevue/config";
const app = createApp(App);

app.use(PrimeVue, { unstyled: true });

Defines the shared pass through properties per component type. Visit the Pass Through Props documentation for more information.


import { createApp } from "vue";
import PrimeVue from "primevue/config";
const app = createApp(App);

app.use(PrimeVue, {
    pt: {
        slider: {
            handle: { class: 'bg-primary text-primary-contrast' }
        }
    }
});

Used to configure the ptOptions properties of components and the usePassThrough method. The mergeSections defines whether the sections from the main configuration gets added and the mergeProps controls whether to override or merge the defined props. Defaults are true for mergeSections and false for mergeProps.


import { createApp } from "vue";
import PrimeVue from "primevue/config";
const app = createApp(App);

app.use(PrimeVue, {
    ptOptions: {
        mergeSections: true,
        mergeProps: false
    }
});

Ripple is an optional animation for the supported components such as buttons. It is disabled by default and needs to be enabled at your app's entry file (e.g. main.js) during the PrimeVue setup.


import { createApp } from "vue";
import PrimeVue from "primevue/config";
const app = createApp(App);

app.use(PrimeVue, { ripple: true });

Input fields come in two styles, default is outlined with borders around the field whereas filled alternative adds a background color to the field. Applying p-variant-filled to an ancestor of an input enables the filled style. If you prefer to use filled inputs in the entire application, use a global container such as the document body or the application element to apply the style class. Note that in case you add it to the application element, components that are teleported to the document body such as Dialog will not be able to display filled inputs as they are not a descendant of the application root element in the DOM tree, to resolve this case set inputVariant to filled at PrimeVue configuration as well.


import {createApp} from "vue";
import PrimeVue from "primevue/config";
const app = createApp(App);

app.use(PrimeVue, { inputVariant: "filled" });

ZIndexes are managed automatically to make sure layering of overlay components work seamlessly when combining multiple components. Still there may be cases where you'd like to configure the configure default values such as a custom layout where header section is fixed. In a case like this, dropdown needs to be displayed below the application header but a modal dialog should be displayed above. PrimeVue configuration offers the zIndex property to customize the default values for components categories. Default values are described below and can be customized when setting up PrimeVue.


import {createApp} from "vue";
import PrimeVue from "primevue/config";
const app = createApp(App);

app.use(PrimeVue, {
    zIndex: {
        modal: 1100,        //dialog, drawer
        overlay: 1000,      //select, popover
        menu: 1000,         //overlay menus
        tooltip: 1100       //tooltip
    }
});

The nonce value to use on dynamically generated style elements in core.


app.use(PrimeVue, {
    csp: {
        nonce: '...'
    }
});

Second parameter of the use function can be used to initiate the locale during PrimeVue installation.


app.use(PrimeVue, {
    locale: {
        accept: 'Aceptar',
        reject: 'Rechazar',
        //...
    }
});

The locale configuration is reactive so that any changes are instantly reflected in the UI. Suppose you are doing a multi language application and need to change the language dynamically.


import { defineComponent, onMounted } from "vue";
import { usePrimeVue } from "primevue/config";

export default defineComponent({
    setup() {
        const changeToSpanish = () => {
            const primevue = usePrimeVue();
            primevue.config.locale.accept = "Aceptar";
            primevue.config.locale.reject = "Rechazar";
        }

        onMounted(() => {
            changeToSpanish();
        })
    }
});

Ready to use settings for locales are available at the community supported PrimeLocale repository. We'd appreciate if you could contribute to this repository with pull requests and share it with the rest of the community.

Configuration is managed by the Locale API imported from primevue/config.

Locale Options

KeyValue
startsWithStarts with
containsContains
notContainsNot contains
endsWithEnds with
equalsEquals
notEqualsNot equals
noFilterNo Filter
ltLess than
lteLess than or equal to
gtGreater than
gteGreater than or equal to
dateIsDate is
dateIsNotDate is not
dateBeforeDate is before
dateAfterDate is after
clearClear
applyApply
matchAllMatch All
matchAnyMatch Any
addRuleAdd Rule
removeRuleRemove Rule
acceptYes
rejectNo
chooseChoose
uploadUpload
cancelCancel
completedCompleted
pendingPending
fileSizeTypes['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
dayNames['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'
dayNamesShort['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'
dayNamesMin['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'
monthNames['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'
monthNamesShort['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
chooseYearChoose Year
chooseMonthChoose Month
chooseDateChoose Date
prevDecadePrevious Decade
nextDecadeNext Decade
prevYearPrevious Year
nextYearNext Year
prevMonthPrevious Month
nextMonthNext Month
prevHourPrevious Hour
nextHourNext Hour
prevMinutePrevious Minute
nextMinuteNext Minute
prevSecondPrevious Second
nextSecondNext Second
amam
pmpm
todayToday
weekHeaderWk
firstDayOfWeek0
showMonthAfterYearfalse
dateFormatmm/dd/yy
weakWeak
mediumMedium
strongStrong
passwordPromptEnter a password
searchMessage{0} results are available
selectionMessage{0} items selected
emptySelectionMessageNo selected item
emptySearchMessageNo results found
fileChosenMessage{0} files
noFileChosenMessageNo file chosen
emptyMessageNo available options
aria.trueLabelTrue
aria.falseLabelFalse
aria.nullLabelNot Selected
aria.star1 star
aria.stars{star} stars
aria.selectAllAll items selected
aria.unselectAllAll items unselected
aria.closeClose
aria.previousPrevious
aria.nextNext
aria.navigationNavigation
aria.scrollTopScroll Top
aria.moveTopMove Top
aria.moveUpMove Up
aria.moveDownMove Down
aria.moveBottomMove Bottom
aria.moveToTargetMove to Target
aria.moveToSourceMove to Source
aria.moveAllToTargetMove All to Target
aria.moveAllToSourceMove All to Source
aria.pageLabelPage {page}
aria.firstPageLabelFirst Page
aria.lastPageLabelLast Page
aria.nextPageLabelNext Page
aria.prevPageLabelPrevious Page
aria.rowsPerPageLabelRows per page
aria.jumpToPageDropdownLabelJump to Page Dropdown
aria.jumpToPageInputLabelJump to Page Input
aria.selectRowRow Selected
aria.unselectRowRow Unselected
aria.expandRowRow Expanded
aria.collapseRowRow Collapsed
aria.showFilterMenuShow Filter Menu
aria.hideFilterMenuHide Filter Menu
aria.filterOperatorFilter Operator
aria.filterConstraintFilter Constraint
aria.editRowRow Edit
aria.saveEditSave Edit
aria.cancelEditCancel Edit
aria.listViewList View
aria.gridViewGrid View
aria.slideSlide
aria.slideNumber{slideNumber}
aria.zoomImageZoom Image
aria.zoomInZoom In
aria.zoomOutZoom Out
aria.rotateRightRotate Right
aria.rotateLeftRotate Left