Skip to main content

Config

Navify Config provides a way to change the properties of components globally across an app. It can set the app mode, tab button layout, animations, and more.

Global Config

To override the initial Navify config for the app, provide your config object as an additional parameter when installing the NavifyKdu plugin:

createApp(App).use(NavifyKdu, {
rippleEffect: false,
mode: 'md',
});

In the above example, we are disabling the Material Design ripple effect across the app, as well as forcing the mode to be Material Design.

Per-Platform Config

Navify Config can also be set on a per-platform basis. For example, this allows you to disable animations if the app is being run in a browser on a potentially slower device. Developers can take advantage of the Platform utilities to accomplish this.

In the following example, we are disabling all animations in our Navify app only if the app is running in a mobile web browser. The isPlatform() call returns true or false based upon the platform that is passed in. See the Platform Documentation for a list of possible values.

import { NavifyKdu, isPlatform } from '@navify/kdu';

createApp(App).use(NavifyKdu, {
animated: !isPlatform('mobileweb'),
});

The next example allows you to set an entirely different configuration based upon the platform, falling back to a default config if no platforms match:

import { NavifyKdu, isPlatform } from '@navify/kdu';

const getConfig = () => {
if (isPlatform('hybrid')) {
return {
backButtonText: 'Previous',
tabButtonLayout: 'label-hide',
};
}

return {
menuIcon: 'ellipsis-vertical',
};
};

createApp(App).use(NavifyKdu, getConfig());

Finally, this example allows you to accumulate a config object based upon different platform requirements:

import { NavifyKdu, isPlatform } from '@navify/kdu';

const getConfig = () => {
let config = {
animated: false,
};

if (isPlatform('iphone')) {
config = {
...config,
backButtonText: 'Previous',
};
}

return config;
};

createApp(App).use(NavifyKdu, getConfig());

Interfaces

Below are the config options that Navify uses.

ConfigTypeDescription
actionSheetEnterAnimationBuilderProvides a custom enter animation for all nav-action-sheet, overriding the default "animation".
actionSheetLeaveAnimationBuilderProvides a custom leave animation for all nav-action-sheet, overriding the default "animation".
alertEnterAnimationBuilderProvides a custom enter animation for all nav-alert, overriding the default "animation".
alertLeaveAnimationBuilderProvides a custom leave animation for all nav-alert, overriding the default "animation".
animatedbooleanIf true, Navify will enable all animations and transitions across the app.
backButtonDefaultHrefstringOverrides the default value for the defaultHref property in all <nav-back-button> components.
backButtonIconstringOverrides the default icon in all <nav-back-button> components.
backButtonTextstringOverrides the default text in all <nav-back-button> components.
hardwareBackButtonbooleanIf true, Navify will respond to the hardware back button in an Android device.
infiniteLoadingSpinnerSpinnerTypesOverrides the default spinner type in all <nav-infinite-scroll-content> components.
loadingEnterAnimationBuilderProvides a custom enter animation for all nav-loading, overriding the default "animation".
loadingLeaveAnimationBuilderProvides a custom leave animation for all nav-loading, overriding the default "animation".
loadingSpinnerSpinnerTypesOverrides the default spinner for all nav-loading overlays.
menuIconstringOverrides the default icon in all <nav-menu-button> components.
menuTypestringOverrides the default menu type for all <nav-menu> components.
modalEnterAnimationBuilderProvides a custom enter animation for all nav-modal, overriding the default "animation".
modalLeaveAnimationBuilderProvides a custom leave animation for all nav-modal, overriding the default "animation".
modeModeThe mode determines which platform styles to use for the whole application.
navAnimationAnimationBuilderOverrides the default "animation" of all nav-nav and nav-router-outlet across the whole application.
pickerEnterAnimationBuilderProvides a custom enter animation for all nav-picker, overriding the default "animation".
pickerLeaveAnimationBuilderProvides a custom leave animation for all nav-picker, overriding the default "animation".
platformPlatformConfigOverrides the default platform detection methods.
popoverEnterAnimationBuilderProvides a custom enter animation for all nav-popover, overriding the default "animation".
popoverLeaveAnimationBuilderProvides a custom leave animation for all nav-popover, overriding the default "animation".
refreshingIconstringOverrides the default icon in all <nav-refresh-content> components.
refreshingSpinnerSpinnerTypesOverrides the default spinner type in all <nav-refresh-content> components.
sanitizerEnabledbooleanIf true, Navify will enable a basic DOM sanitizer on component properties that accept custom HTML.
spinnerSpinnerTypesOverrides the default spinner in all <nav-spinner> components.
statusTapbooleanIf true, clicking or tapping the status bar will cause the content to scroll to the top.
swipeBackEnabledbooleanIf true, Navify will enable the "swipe-to-go-back" gesture across the application.
tabButtonLayoutTabButtonLayoutOverrides the default "layout" of all nav-bar-button across the whole application.
toastDurationnumberOverrides the default duration for all nav-toast components.
toastEnterAnimationBuilderProvides a custom enter animation for all nav-toast, overriding the default "animation".
toastLeaveAnimationBuilderProvides a custom leave animation for all nav-toast, overriding the default "animation".
toggleOnOffLabelsbooleanOverrides the default enableOnOffLabels in all nav-toggle components.