Luigi Core API
July 31, 2026 · View on GitHub
This document outlines the features provided by the Luigi Core API. It covers these topics:
- Configuration - functions related to Luigi configuration
- Elements - functions related to DOM elements
- Navigation - functions related to Luigi navigation
- Localization - options related to language, translation, and localization
- Custom messages - custom messages between Luigi Core and micro frontends
- UX - functions related to Luigi's appearance and user interface
- Global search - functions related to Luigi's global search
- Theming - functions related to Luigi theming capabilties
- Feature toggles - functions related to Luigi's feature toggle mechanism
- Routing - functions to get and set search query parameters
- Authorization - authorization options for Luigi
Luigi Config
Configuration
setConfig
Sets the configuration for Luigi initially. Can also be called at a later point in time again to update the configuration.
Params
- configInput
Object- the Luigi Core configuration object
Example
Luigi.setConfig({
navigation: {
nodes: () => [
{
pathSegment: 'home',
label: 'Home',
children: [
{
pathSegment: 'hello',
label: 'Hello Luigi!',
viewUrl: '/assets/basicexternal.html'
}
]
}
]
},
routing: {
useHashRouting: true
}
})
getConfig
Returns the current active configuration
Example
Luigi.getConfig()
Returns: Object - configuration object
configChanged
Tells Luigi that the configuration has been changed. Luigi will update the application or parts of it based on the specified scope.
Params
- ...scope
string- one or more scope selectors specifying what parts of the configuration were changed. If no scope selector is provided, the whole configuration is considered changed.
The supported scope selectors are:
navigation: the navigation part of the configuration was changed. This includes navigation nodes, the context switcher, the product switcher and the profile menu.navigation.nodes: navigation nodes were changed.navigation.contextSwitcher: context switcher related data were changed.navigation.productSwitcher: product switcher related data were changed.navigation.profile: profile menu was changed.settings: settings were changed.settings.header: header settings (title, icon) were changed.settings.footer: left navigation footer settings were changed.
getConfigValue
Gets value of the given property on Luigi config object. Target can be a value or a synchronous function.
Params
- property
string- the object traversal path
Example
Luigi.getConfigValue('auth.use')
Luigi.getConfigValue('settings.sideNavFooterText')
getConfigBooleanValue
Gets boolean value of the given property on Luigi config object. Function return true if the property value is equal true or 'true'. Otherwise the function returns false.
Params
- property
string- the object traversal path
Example
Luigi.getConfigBooleanValue('settings.hideNavigation')
getConfigValueAsync
Gets value of the given property on the Luigi config object. If the value is a Function it is called (with the given parameters) and the result of that call is the value. If the value is not a Promise it is wrapped to a Promise so that the returned value is definitely a Promise.
Params
- property
string- the object traversal path - ...parameters
*- optional parameters that are used if the target is a function
Example
Luigi.getConfigValueAsync('navigation.nodes')
Luigi.getConfigValueAsync('navigation.profile.items')
Luigi.getConfigValueAsync('navigation.contextSwitcher.options')
isAuthorizationEnabled
Detects if authorization is enabled via configuration.
Returns: boolean - returns true if authorization is enabled. Otherwise returns false.
Meta:
- deprecated: now located in Luigi.auth() instead of Luigi
unload
Unloads the current Luigi instance, which can be initialized later again by using Luigi.setConfig({...})
Example
Luigi.unload()
Meta:
- since: 1.2.2
readUserSettings
Reads the user settings object.
You can choose a custom storage to read the user settings by implementing the userSettings.readUserSettings function in the settings section of the Luigi configuration.
By default, the user settings will be read from the localStorage
Example
Luigi.readUserSettings();
Returns: promise - a promise when a custom readUserSettings function in the settings.userSettings section of the Luigi configuration is implemented. It resolves a stored user settings object. If the promise is rejected the user settings dialog will also closed if the error object has a closeDialog property, e.g reject({ closeDialog: true, message: 'some error' }). In addition a custom error message can be logged to the browser console.
Meta:
- since: 1.7.1
storeUserSettings
Stores the user settings object.
You can choose a custom storage to write the user settings by implementing the userSetting.storeUserSettings function in the settings section of the Luigi configuration
By default, the user settings will be written from the localStorage
Params
- userSettingsObj
Object- to store in the storage - previousUserSettingsObj
Object- the previous object from storage
Example
Luigi.storeUserSettings(userSettingsobject, previousUserSettingsObj);
Returns: promise - a promise when a custom storeUserSettings function in the settings.userSettings section of the Luigi configuration is implemented. If it is resolved the user settings dialog will be closed. If the promise is rejected the user settings dialog will also closed if the error object has a closeDialog property, e.g reject({ closeDialog: true, message: 'some error' }). In addition a custom error message can be logged to the browser console.
Meta:
- since: 1.7.1
reset
Reset the current Luigi instance and initialize Luigi with the latest Luigi config.
Example
Luigi.reset();
Meta:
- since: 1.14.0
clearNavigationCache
Clear navigation node related caches.
Example
Luigi.clearNavigationCache();
Meta:
- since: 1.19.0
setGlobalContext
Set the global context object and triggers the corresponding update.
Params
- ctx
Object- the context object to set - preventUpdate
boolean- if true, no view update is triggered; default is false
Meta:
- since: 2.5.0
getGlobalContext
Get the global context object.
Meta:
- since: 2.5.0
updateContextValues
Updates the context values for all micro frontends currently in the DOM (iframes and web components). Note: the updated context values are not persisted. The developers have to do it on their own.
Params
- ctx
Object- the context to be updated
Meta:
- since: 2.13.0
Luigi.elements()
Elements
Use these functions to get DOM elements.
getLuigiContainer
Returns the container of the Luigi content.
Example
Luigi.elements().getLuigiContainer();
Returns: HTMLElement - the DOM element that wraps the Luigi content
Meta:
- since: 0.6.0
getShellbar
Returns the shellbar component.
Example
Luigi.elements().getShellbar();
Returns: HTMLElement - the shellbar DOM element
Meta:
- since: 0.4.12
getShellbarActions
Returns the shellbar actions component.
Example
Luigi.elements().getShellbarActions();
Returns: HTMLElement - the shellbar actions DOM element
Meta:
- since: 0.4.12
getMicrofrontends
Returns a list of all available micro frontends.
Example
Luigi.elements().getMicrofrontends();
Returns: Array.<{id: string, active: boolean, container: HTMLElement, type: ('main'|'split-view'|'modal')}> - list of objects defining all micro frontends from the DOM
Meta:
- since: 0.6.2
getMicrofrontendIframes
Returns all micro frontend iframes including the iframe from the modal if it exists.
Example
Luigi.elements().getMicrofrontendIframes();
Returns: Array.<HTMLElement> - an array of all micro frontend iframes from the DOM
Meta:
- since: 0.4.12
getCurrentMicrofrontendIframe
Returns the active micro frontend iframe. If there is a modal, which includes the micro frontend iframe, the function returns this iframe.
Example
Luigi.elements().getCurrentMicrofrontendIframe();
Returns: HTMLElement - the active micro frontend iframe DOM element
Meta:
- since: 0.4.12
getNavFooterContainer
Returns a navigation footer container.
Example
Luigi.elements().getNavFooterContainer();
Returns: HTMLElement - the navigation footer DOM element
Meta:
- since: 1.21.0
Luigi.navigation()
LuigiNavigation
Use these functions for navigation-related features.
updateTopNavigation
Refreshes top navigation badge counters by rendering the navigation again.
Example
Luigi.navigation().updateTopNavigation();
navigate
Navigates to the given path in the application. It contains either a full absolute path or a relative path without a leading slash that uses the active route as a base. This is the standard navigation.
Params
- path
string- path to be navigated to - preserveView
boolean- preserve a view by setting it totrue. It keeps the current view opened in the background and opens the new route in a new frame. Use the goBack() function to navigate back. You can use this feature across different levels. Preserved views are discarded as soon as you use the standard navigate() function instead of goBack() - modalSettings
Object- opens a view in a modal. Use these settings to configure the modal's title and size- .title
string- modal title. By default, it is the node label. If there is no label, it is left empty - [.size]
'fullscreen'|'l'|'m'|'s'= "l"- size of the modal - .width
string- updates thewidthof the modal. Allowed units are 'px', '%', 'rem', 'em', 'vh' and 'vw'. - .height
string- updates theheightof the modal. Allowed units are 'px', '%', 'rem', 'em', 'vh' and 'vw'. - .keepPrevious
boolean- lets you open multiple modals. Keeps the previously opened modal and allows to open another modal on top of the previous one. By default the previous modals are discarded. - .closebtn_data_testid
string- lets you specify adata_testidfor the close button. Default value islui-modal-index-0. If multiple modals are opened the index will be increased per modal.
- .title
- splitViewSettings
Object- opens a view in a split view. Use these settings to configure the split view's behaviour- .title
string- split view title. By default, it is the node label. If there is no label, it is left empty - [.size]
number= 40- height of the split view in percent - [.collapsed]
boolean= false- opens split view in collapsed state
- .title
- drawerSettings
Object- opens a view in a drawer. Use these settings to configure if the drawer has a header, backdrop and size.- .header
any- by default, the header is visible. The default title is the node label, but the header could also be an object with atitleattribute allowing you to specify your own title. An 'x' icon is displayed to close the drawer view. - .backdrop
boolean- by default, it is set tofalse. If it is set totruethe rest of the screen has a backdrop. - [.size]
'l'|'m'|'s'|'xs'= "s"- size of the drawer
- .header
Example
Luigi.navigation().navigate('/overview')
Luigi.navigation().navigate('users/groups/stakeholders')
Luigi.navigation().navigate('/settings', null, true) // preserve view
navigateToIntent
Offers an alternative way of navigating with intents. This involves specifying a semanticSlug and an object containing parameters.
Params
- semanticSlug
string- concatenation of semantic object and action connected with a dash (-) - params
Object- an object representing all the parameters passed (optional, default '{}')
Example
Luigi.navigation().navigateToIntent('Sales-settings')
Luigi.navigation().navigateToIntent('Sales-settings', {project: 'pr1'})
Meta:
- since: 2.14.2
openAsModal
Opens a view in a modal. You can specify the modal's title and size. If you do not specify the title, it is the node label. If there is no node label, the title remains empty. The default size of the modal is l, which means 80%. You can also use m (60%) and s (40%) to set the modal size. Optionally, use it in combination with any of the navigation functions.
Params
- path
string- navigation path - [modalSettings]
Object- opens a view in a modal. Use these settings to configure the modal's title and size- .title
string- modal title. By default, it is the node label. If there is no label, it is left empty - [.size]
'fullscreen'|'l'|'m'|'s'= "l"- size of the modal - .width
string- updates thewidthof the modal. Allowed units are 'px', '%', 'rem', 'em', 'vh' and 'vw'. - .height
string- updates theheightof the modal. Allowed units are 'px', '%', 'rem', 'em', 'vh' and 'vw'. - .keepPrevious
boolean- lets you open multiple modals. Keeps the previously opened modal and allows to open another modal on top of the previous one. By default the previous modals are discarded. - .closebtn_data_testid
string- lets you specify adata_testidfor the close button. Default value islui-modal-index-0. If multiple modals are opened the index will be increased per modal.
- .title
- onCloseCallback
function- callback function called upon closing the opened modal
Example
Luigi.navigation().openAsModal('projects/pr1/users', {title:'Users', size:'m'});
openAsSplitView
Opens a view in a split view. You can specify the split view's title and size. If you don't specify the title, it is the node label. If there is no node label, the title remains empty. The default size of the split view is 40, which means 40% height of the split view.
See: SplitView Client for further documentation. These methods from the Client SplitView are also implemented for Luigi Core: close, collapse, expand, isCollapsed, isExpanded, exists
Params
- path
string- navigation path - splitViewSettings
Object- opens a view in a split view. Use these settings to configure the split view's behaviour- .title
string- split view title. By default, it is the node label. If there is no label, it is left empty - [.size]
number= 40- height of the split view in percent - [.collapsed]
boolean= false- opens split view in collapsed state
- .title
Example
Luigi.navigation().openAsSplitView('projects/pr1/users', {title:'Users', size:'40'});
Returns: Object - an instance of the SplitView. It provides functions to control its behavior.
Meta:
- since: 0.7.6
openAsDrawer
Opens a view in a drawer. You can specify if the drawer has a header, if a backdrop is active in the background and configure the size of the drawer. By default the header is shown. The backdrop is not visible and has to be activated. The size of the drawer is by default set to s which means 25% of the micro frontend size. You can also use l(75%), m(50%) or xs(15.5%). Optionally, use it in combination with any of the navigation functions.
Params
- path
string- navigation path - [drawerSettings]
Object- opens a view in a drawer. Use these settings to configure if the drawer has a header, backdrop and size.- .header
any- by default, the header is visible. Title is node label and 'x' is displayed to close the drawer view. The header could also be an object with atitleattribute to specify an own title for the drawer component. - .backdrop
boolean- by default, it is set tofalse. If it is set totruethe rest of the screen has a backdrop. - [.size]
'l'|'m'|'s'|'xs'= "s"- size of the drawer
- .header
Example
Luigi.navigation().openAsDrawer('projects/pr1/drawer', {header:true, backdrop:true, size:'s'});
Luigi.navigation().openAsDrawer('projects/pr1/drawer', {header:{title:'My drawer component'}, backdrop:true, size:'xs'});
Meta:
- since: 1.6.0
fromContext
Sets the current navigation context to that of a specific parent node which has the navigationContext field declared in the navigation configuration. This navigation context is then used by the navigate function.
Params
- navigationContext
string
Example
Luigi.navigation().fromContext('project').navigate('/settings')
Returns: linkManager - link manager instance
fromClosestContext
Sets the current navigation context which is then used by the navigate function. This has to be a parent navigation context, it is not possible to use the child navigation contexts.
Example
Luigi.navigation().fromClosestContext().navigate('/users/groups/stakeholders')
Returns: linkManager - link manager instance
fromVirtualTreeRoot
Sets the current navigation base to the parent node that is defined as virtualTree. This method works only when the currently active micro frontend is inside a virtualTree.
Example
Luigi.navigation().fromVirtualTreeRoot().navigate('/users/groups/stakeholders')
Returns: linkManager - link manager instance
Meta:
- since: 1.0.1
fromParent
Enables navigating to sibling nodes without knowing the absolute path.
Example
Luigi.navigation().fromParent().navigate('/sibling')
Returns: linkManager - link manager instance
Meta:
- since: 2.14.0
getCurrentRoute
Gets the Luigi route associated with the current micro frontend.
Example
Luigi.navigation().getCurrentRoute();
Luigi.navigation().fromContext('project').getCurrentRoute();
Luigi.navigation().fromVirtualTreeRoot().getCurrentRoute();
Returns: a String value specifying the current Luigi route
Meta:
- since: 2.14.0
withParams
Sends node parameters to the route. The parameters are used by the navigate function. Use it optionally in combination with any of the navigation functions and receive it as part of the context object in Luigi Client.
Params
- nodeParams
Object
Example
Luigi.navigation().withParams({foo: "bar"}).navigate("path")
// Can be chained with context setting functions such as:
Luigi.navigation().fromContext("currentTeam").withParams({foo: "bar"}).navigate("path")
Returns: linkManager - link manager instance
pathExists
Checks if the path you can navigate to exists in the main application. For example, you can use this helper method conditionally to display a DOM element like a button.
Params
- path
string- path which existence you want to check
Example
let pathExists;
Luigi
.navigation()
.pathExists('projects/pr2')
.then(
(pathExists) => { }
);
Returns: promise - a promise which resolves to a Boolean variable specifying whether the path exists or not
hasBack
Checks if there is one or more preserved views. You can use it to show a back button.
Returns: boolean - indicating if there is a preserved view you can return to
goBack
Discards the active view and navigates back to the last visited view. Works with preserved views, and also acts as the substitute of the browser back button. goBackContext is only available when using preserved views.
Params
- goBackValue
any- data that is passed in the goBackContext field to the last visited view when using preserved views
Example
Luigi.navigation().goBack({ foo: 'bar' });
Luigi.navigation().goBack(true);
Luigi.i18n()
LuigiI18N
Localization-related functions.
getCurrentLocale
Gets the current locale.
Returns: string - current locale
Meta:
- since: 0.5.3
setCurrentLocale
Sets current locale to the specified one.
Params
- locale
string- locale to be set as the current locale
Meta:
- since: 0.5.3
addCurrentLocaleChangeListener
Registers a listener for locale changes.
Params
- listener
function- function called on every locale change with the new locale as argument
Returns: number - listener ID associated with the given listener; use it when removing the listener
Meta:
- since: 0.5.3
removeCurrentLocaleChangeListener
Unregisters a listener for locale changes.
Params
- listenerId
number- listener ID associated with the listener to be removed, returned by addCurrentLocaleChangeListener
Meta:
- since: 0.5.3
getTranslation
Gets translated text for the specified key in the current locale or in the specified one. Property values for token replacement in the localization key will be taken from the specified interpolations object.
TIP: Be aware that this function is not asynchronous and therefore the translation table must be existing already at initialization. Take a look at our i18n section for an implementation suggestion.
Params
- key
string- key to be translated - interpolations
Object- objects with properties that will be used for token replacements in the localization key - locale
locale- optional locale to get the translation for; default is the current locale
Meta:
- since: 0.5.3
Luigi.customMessages()
CustomMessages
Functions related to custom messages.
sendToAll
Sends a custom message to all opened micro frontends.
Params
- message
Object- an object containing data to be sent to the micro frontend to process it further. This object is set as an input parameter of the custom message listener on the micro frontend side.- .id
string- the id of the message - .MY_DATA_FIELD
*- any other message data field
- .id
Example
Luigi.customMessages().sendToAll({
id: 'myprefix.my-custom-message-for-client',
dataField1: 'here goes some data',
moreData: 'here goes some more'
});
Meta:
- since: 0.6.2
send
Sends a message to specific micro frontend identified with an id. Use Luigi.elements().getMicrofrontends() to get the iframe id.
Params
- microfrontendId
number- the id of the micro frontend - message
Object- an object containing data to be sent to the micro frontend to process it further. This object is set as an input parameter of the custom message listener on the micro frontend side- .id
number- the id of the message - .MY_DATA_FIELD
*- any other message data field
- .id
Example
Luigi.customMessages().send(microfrontend.id, {
id: 'myprefix.my-custom-message-for-client',
dataField1: 'here goes some data',
moreData: 'here goes some more'
});
Meta:
- since: 0.6.2
Luigi.ux()
UX
Functions to use Luigi Core UX features.
hideAppLoadingIndicator
Hides the app loading indicator.
Meta:
- since: 0.6.4
showAlert
Shows an alert.
Params
- settings
Object- the settings for the alert- .text
string- the content of the alert. To add a link to the content, you have to set up the link in thelinksobject. The key(s) in thelinksobject must be used in the text to reference the links, wrapped in curly brackets with no spaces. If you do not specify any text, the alert is not displayed - .type
'info'|'success'|'warning'|'error'- sets the type of alert - .links
Object- provides links data- .LINK_KEY
Object- object containing the data for a particular link. To properly render the link in the alert message refer to the description of the settings.text parameter- .text
string- text which replaces the link identifier in the alert content - .url
string- URL to navigate when you click the link. Currently, only internal links are supported in the form of relative or absolute paths - .dismissKey
string- dismissKey which represents the key of the link.
- .text
- .LINK_KEY
- .closeAfter
number- (optional) time in milliseconds that tells Luigi when to close the Alert automatically. If not provided, the Alert will stay on until closed manually. It has to be greater than100
- .text
Example
const settings = {
text: "Ut enim ad minim veniam, {goToHome} quis nostrud exercitation ullamco {relativePath}. Duis aute irure dolor {goToOtherProject} or {neverShowItAgain}",
type: 'info',
links: {
goToHome: { text: 'homepage', url: '/overview' },
goToOtherProject: { text: 'other project', url: '/projects/pr2' },
relativePath: { text: 'relative hide side nav', url: 'hideSideNav' },
neverShowItAgain: { text: 'Never show it again', dismissKey: 'neverShowItAgain' }
},
closeAfter: 3000
}
Luigi
.ux()
.showAlert(settings)
.then(() => {
// Logic to execute when the alert is dismissed
});
Returns: promise - which is resolved when the alert is dismissed
Meta:
- since: 0.6.4
showConfirmationModal
Shows a confirmation modal.
Params
- settings
Object- the settings of the confirmation modal. If you do not provide any value for any of the fields, a default value is used- .type
'confirmation'|'success'|'warning'|'error'|'information'- the content of the modal type. (Optional) - [.header]
string= ""Confirmation""- the content of the modal header - [.body]
string= ""Are you sure you want to do this?""- the content of the modal body. It supports HTML formatting elements such as<br>,<b>,<strong>,<i>,<em>,<mark>,<small>,<del>,<ins>,<sub>,<sup>. - [.buttonConfirm]
string|false= ""Yes""- the label for the modal confirmation button. If set tofalse, the button will not be shown. - [.buttonDismiss]
string= ""No""- the label for the modal dismiss button
- .type
Example
const settings = {
header: "Confirmation",
body: "Are you sure you want to do this?",
buttonConfirm: "Yes",
buttonDismiss: "No"
}
Luigi
.ux()
.showConfirmationModal(settings)
.then(() => {
// Logic to execute when the confirmation modal is dismissed
});
Returns: promise - which is resolved when accepting the confirmation modal and rejected when dismissing it
Meta:
- since: 0.6.4
setDocumentTitle
Set the document title
Params
- documentTitle
string
Example
Luigi.ux().setDocumentTitle('Luigi');
Meta:
- since: 1.4.0
getDocumentTitle
Get the document title
Example
Luigi.ux().getDocumentTitle();
Returns: string - a string, which is displayed in the tab.
Meta:
- since: 1.4.0
collapseLeftSideNav
Set the collapsed state of the left side navigation
Params
- state
boolean
Meta:
- since: 1.5.0
openUserSettings
Open user settings dialog
Meta:
- since: 1.7.1
closeUserSettings
Close user settings dialog
Meta:
- since: 1.7.1
getDirtyStatus
Returns the dirty status, which is set by the Client via setDirtyStatus. By default, the dirty status is false.
Meta:
- since: 2.1.0
getCurrentTheme
Returns the current active theme. Falls back to defaultTheme if one wasn't explicitly specified before.
Example
Luigi.ux().getCurrentTheme()
Returns: string - theme id
Meta:
- since: 2.14.0
Luigi.globalSearch()
GlobalSearch
Functions to use Luigi Global Search.
openSearchField
Opens the global search field.
Example
Luigi.globalSearch().openSearchField();
Meta:
- since: 1.3.0
closeSearchField
Closes the global search field.
Example
Luigi.globalSearch().closeSearchField();
Meta:
- since: 1.3.0
clearSearchField
Clears the global search field.
Example
Luigi.globalSearch().clearSearchField();
Meta:
- since: 1.3.0
showSearchResult
Opens the global search result. By standard it is a popover.
Params
- searchResultItems
Array
Example
let searchResultItem = {
pathObject: {
link,
params: {}
},
label,
description
}
Luigi.globalSearch().showSearchResult([searchResultItem1, searchResultItem2]);
Meta:
- since: 1.3.0
closeSearchResult
Closes the global search result. By standard it is rendered as a popover.
Example
Luigi.globalSearch().closeSearchResult();
Meta:
- since: 1.3.0
getSearchString
Gets the value of the search input field.
Example
Luigi.globalSearch().getSearchString();
Meta:
- since: 1.3.0
setSearchString
Sets the value of the search input field.
Params
- searchString - search value
Example
Luigi.globalSearch().setSearchString('searchString');
Meta:
- since: 1.3.0
setSearchInputPlaceholder
Sets the value of the Placeholder search input field.
Params
- searchString - search value
Example
Luigi.globalSearch().setSearchInputPlaceholder('HERE input Placeholder');
Meta:
- since: 1.7.1
Luigi.theming()
Theming
Functions to use Luigi Core Theming features.
getAvailableThemes
Retrieves the available themes
Example
Luigi
.theming()
.getAvailableThemes()
.then((themes) => {
// Logic to generate theme selector
});
Returns: promise - resolves an array of theming objects
Meta:
- since: 1.4.0
setCurrentTheme
Sets the current theme id
Params
- id
string- of a theme object
Example
Luigi.theming().setCurrentTheme('light')
Meta:
- since: 1.4.0
getThemeObject
Retrieves a theme object by name.
Params
- id
string- theme id
Example
Luigi
.theming()
.getThemeObject('light')
.then((id => {
// Logic
}))
Returns: promise - resolves a theme object
Meta:
- since: 1.4.0
getCurrentTheme
Retrieves the current active theme. Falls back to defaultTheme if none explicitly specified before.
Example
Luigi.theming().getCurrentTheme()
Returns: string - theme id
Meta:
- since: 1.4.0
isThemingAvailable
The general status about the Theming configuration.
Example
Luigi.theming().isThemingAvailable()
Returns: boolean - true if settings.theming configuration object is defined
Meta:
- since: 1.4.0
getCSSVariables
Returns CSS variables with key value from Luigi if @luigi-project/core/luigi_theme-vars.js is included in the index.html and settings.theming.variables==='fiori' is defined in the settings section.
It's also possible to define your own variables file which can be declared in settings.theming.variables.file in the settings section.
The variables should be defined in a JSON file which starts with a root key.
When you configure you own file, you can also implement exception handling by using the function settings.theming.variables.errorHandling which gets the error object as argument.
Example
Luigi.theming().getCSSVariables();
Returns: Object - CSS variables with their value.
Meta:
- since: 2.3.0
Luigi.featureToggles()
FeatureToggles
Functions to use feature toggles in Luigi.
setFeatureToggle
Add a feature toggle to an active feature toggles list
Params
- featureToggleName
string- the name of the feature toggle
Example
Luigi.featureToggles().setFeatureToggle('featureToggleName');
Meta:
- since: 1.4.0
unsetFeatureToggle
Remove a feature toggle from the list
Example
Luigi.featureToggles().unsetFeatureToggle('featureToggleName');
Meta:
- since: 1.4.0
getActiveFeatureToggleList
Get a list of active feature toggles
Example
Luigi.featureToggles().getActiveFeatureToggleList();
Returns: Array - of active feature toggles
Meta:
- since: 1.4.0
Luigi.routing()
Routing
Use these functions for navigation-related features.
getSearchParams
Get search parameter from URL as an object.
Example
Luigi.routing().getSearchParams();
Meta:
- since: 1.16.1
addSearchParams
Add search parameters to the URL. If hash routing is enabled, the search parameters will be set after the hash. In order to delete a search query param you can set the value of the param to undefined.
Params
- params
Object - keepBrowserHistory
boolean - preventLuigiConfigUpdate
boolean= false- If true, the configChanged function will be triggered (since 2.29.0). By default it is set tofalse.
Example
Luigi.routing().addSearchParams({luigi:'rocks', mario:undefined}, false);
Meta:
- since: 1.16.1
Luigi.auth()
Authorization
Authorization helpers.
isAuthorizationEnabled
Detects if authorization is enabled via configuration. Read more about custom authorization providers.
Example
Luigi.auth().isAuthorizationEnabled();
Returns: boolean - true if authorization is enabled - otherwise returns false
login
Login the user dynamically. This will run the same functionality as though the user clicked the login button.
Example
Luigi.auth().login();
Meta:
- since: 1.5.0
logout
Logout the user dynamically. This will run the same functionality as though the user clicked the logout button.
Example
Luigi.auth().logout();
Meta:
- since: 1.5.0
AuthData
Authorization object that is stored in auth store and used within Luigi. It is then available in LuigiClient.addInitListener and can also be used in the Core configuration.
Type: Object
Properties
| Name | Type | Description |
|---|---|---|
| accessToken | string | access token value |
| accessTokenExpirationDate | string | timestamp value |
| scope | string | scope, can be empty if it is not required |
| idToken | string | id token, used for renewing authentication |
AuthorizationStore
store
Getter for authorization Storage helpers, to be used in your custom authorization provider. Read more about custom authorization providers here.
Returns: Object - authorization storage helpers
getStorageKey
Retrieves the key name that is used to store the auth data.
Example
Luigi.auth().store.getStorageKey()
Returns: string - name of the store key
getStorageType
Retrieves the storage type that is used to store the auth data. To set it, use the storage property of the auth Luigi configuration object. Find out more here.
Example
Luigi.auth().store.getStorageType()
Returns: 'localStorage' | 'sessionStorage' | 'none' - storage type
getAuthData
Retrieves the current auth object.
Example
Luigi.auth().store.getAuthData()
Returns: AuthData - the current auth data object
setAuthData
Sets authorization data
Params
- data
AuthData- new auth data object
Example
Luigi.auth().store.setAuthData(data)
removeAuthData
Clears authorization data from store
Example
Luigi.auth().store.removeAuthData()
setNewlyAuthorized
Defines a new authorization session. Must be triggered after initial setAuthData() in order to trigger onAuthSuccessful event after login.
Example
Luigi.auth().store.setNewlyAuthorized()