Layout
Last updated
Last updated
Nectar is a Single Page Application (SPA). Therefore, the entry point to every browser request is index.html
In an SPA, only a single web page is loaded, called the app shell, and the consecutive pages are loaded inside this app shell using XMLHttpRequest and Fetch, without loading whole new pages from the server.
In Nectar, this app shell layout is defined inside /partials/app.html
Nectar provides two main types of navigation layouts which are widely used in apps — Single View Layout and Tab View Layout.
In Single View Layout, the app is mainly navigated using a off-canvas sidebar. Optionally, a bottom tabbar at /home/
can also be present for secondary navigation.
In Tab View Layout, the app is mainly navigated using a bottom tabbar. Optionally, a sidebar can also be present for secondary navigation.
The Single View Layout is based on , while the Tab View Layout is based on .
You can configure and set up your app layout using the configuration variables present inside /assets/custom/js/config.js
Open /assets/custom/js/config.js
Inside window.config.layout = {
Set default: 'singleView'
Inside singleView
object, you can enable or disable the sidebar
and tabbar
, by setting the enabled
value to true
or false
respectively.
The layout for Sidebar Menu is defined inside /partials/sidebar.html
You can change the sidebar menu items as per your requirements.
The layout for Tabbar Menu is defined inside /partials/tabbar.html
You can change the tabbar menu items as per your requirements.
Once you have changed the tabbar menu items, you will also need to change routes for them.
Open /assets/custom/js/routes.js
Inside if (window.config.layout.default == 'singleView' && window.config.layout.singleView.tabbar.enabled) {
Change the path
parameter value according to the changes you made in /partials/tabbar.html
Open /assets/custom/js/config.js
Inside window.config.layout = {
Set default: 'tabView'
Inside tabView
object, you can enable or disable the sidebar
, by setting the enabled
value to true
or false
respectively.
The layout for Sidebar Menu is defined inside /partials/sidebar.html
You can change the sidebar menu items as per your requirements.
Open /partials/app.html
Inside <template>
${$f7.config.layout.default == 'tabView' && $h`
, define the tabbar menu items.
Inside <script>
if ($f7.config.layout.default == 'tabView') {
, change the url
parameters for each view, as per the tabbar menu items you have defined in the above step.
You can control the Sidebar by using following functions:
You can control the Tabbar by using following functions: