Folder layout
The download holds two kinds of files: the finished pages you open in the browser, and the source they are assembled from.
| Path | What it is |
|---|---|
*.html | The finished English pages, such as index.html. Generated by the build — do not edit. |
id/ | The finished Indonesian pages, with the same file names. Generated by the build — do not edit. |
assets/css/ | selaras.css — every Selaras style. All template classes start with sl-, so they never collide with Bootstrap or your own CSS. |
assets/js/ | selaras.js runs on every page (sidebar, customizer, charts, shared helpers). The other scripts belong to one app or page and load only where they are needed. |
assets/vendor/ | The third-party libraries and the font, one folder per library with its license — see Plugins & licenses. Written by tools/vendor.mjs from the list in vendor.json. |
assets/i18n/ | id.js — the Indonesian dictionary for text written by JavaScript. Generated from i18n/id.json. |
src/layout*.html | The page frames: layout.html (dashboards and apps, with the sidebar and top bar), layout-auth.html (sign-in pages), layout-error.html (404 and 500) and layout-store.html (the buyer-facing store). |
src/partials/ | Pieces shared by the layouts: head.html (meta tags, fonts, stylesheets and the theme script), symbols.html (the logo mark), customizer.html, the header and footer of pages without a sidebar, and the brand panels of the sign-in pages (showcase-*.html). |
src/pages/ | The content of every page — one file per page, starting with a settings comment. |
i18n/ | id.json (the Indonesian dictionary), docs-id.json (the same for these documentation pages) and missing-id.txt (a report of text that has no translation yet). |
tools/i18n/ | Python helpers for adding translations — see Languages. |
tools/check-contrast.py | A contrast check for the color themes — see Themes & appearance. |
tools/vendor.mjs | Copies the libraries listed in vendor.json into assets/vendor/ — see Update a library. |
build.mjs | The build script. It also holds the sidebar menu and the list of themes. |
Edit the source, not the pages
Each finished page is the result of a layout, the shared partials and one file from src/pages/. The sidebar, the top bar, the customizer and the <head> are written once and reused by every page, so a change there reaches all pages at the next build.
Every run rewrites all *.html files in the template folder and in id/. Anything you change directly in those files is lost at the next build — make the change in src/ instead.
CSS and JavaScript are not generated: edit the files in assets/css/ and assets/js/ directly. The only exception is assets/i18n/id.js, which the build writes from i18n/id.json.
Building the pages
Run the build from the template folder. It needs Node.js 18 or newer and nothing else:
node build.mjs For every file in src/pages/, the build:
- reads the settings comment on the first line and picks the layout;
- fills in the title, breadcrumb, sidebar menu, extra stylesheets and scripts;
- turns code markers into code snippets with a Copy button;
- writes the English page next to
build.mjsand the Indonesian page toid/.
It prints one line per page and a summary at the end. Text that has no Indonesian translation yet is listed in i18n/missing-id.txt, with the pages it appears on.
Build one language
Add --lang to build only the English or only the Indonesian pages:
node build.mjs --lang en
node build.mjs --lang id With --lang en the id/ folder is left untouched and no translation report is written. With --lang id only id/, assets/i18n/id.js and the translation report are written.
Add a page
- Create a file in
src/pages/, for examplesrc/pages/reports.html. Its name becomes the name of the finished page (reports.htmlandid/reports.html). - Start it with the settings comment, then write the page content — only what goes inside the content area, without
<html>,<head>or the sidebar. - Optional: add the page to the sidebar menu (see The sidebar menu).
- Run
node build.mjsand openreports.html.
<!--meta {"title":"Reports","active":"reports","crumbParent":"Pages","crumbHref":"pages-profile.html","crumb":"Reports","crumbIcon":"ti-report-analytics","scripts":["assets/js/reports.js"]} -->
<div class="sl-page-head">
<div>
<h1 class="sl-page-title">Reports</h1>
<p class="sl-page-sub">Monthly figures for the whole team.</p>
</div>
</div>
<section class="sl-card">
<div class="sl-card-head"><div><h2 class="sl-card-title">This month</h2><p class="sl-card-sub">Updated daily</p></div></div>
<!-- your content -->
</section> Copy the building blocks from UI Kit › Components — every example there has a Show code button. Scripts you list in scripts load after selaras.js, so they can use its helpers.
The build also writes id/reports.html. Until you add translations, its text stays in English and is listed in i18n/missing-id.txt — see Languages.
Page settings
The first line of every page file is a comment that starts with <!--meta and holds a JSON object. It must be valid JSON: double quotes around every key and text, and a backslash before any quote inside a text (see the example below). These are all the options the build understands:
| Option | What it does |
|---|---|
title | Required. The browser tab title, followed by “· Selaras Admin” (“· Selaras Store” on store pages). |
layout | The page frame: app (the default), auth, error or store — see below. |
active | The key of the sidebar item to highlight as the current page. |
crumb | The current page in the breadcrumb of the top bar. Needed on app pages. |
crumbIcon | The Tabler icon class in front of crumb, such as ti-report-analytics. Needed on app pages. |
crumbParent | The first part of the breadcrumb. Default: Dashboards. |
crumbHref | Where the first part of the breadcrumb links to. Default: index.html. |
actions | HTML placed in the top bar, after the standard buttons — for example a primary button. Only on app pages. |
scripts | A list of script URLs, loaded at the end of the page after selaras.js. |
styles | A list of stylesheet URLs, loaded before selaras.css so the Selaras look wins over a library’s own styles. |
showcase | Only with "layout":"auth": the brand panel next to the form — product, signup or security (from src/partials/showcase-*.html). |
nav | docs shows the documentation menu instead of the main menu. Used by these documentation pages. |
An example with a button in the top bar, taken from the Invoices page:
<!--meta {"title":"Invoices","active":"invoices","crumbParent":"Apps","crumb":"Invoices","crumbIcon":"ti-file-invoice","actions":"<a class=\"sl-btn sl-btn-primary\" href=\"app-invoice-edit.html\"><i class=\"ti ti-plus\"></i><span>New invoice</span></a>","scripts":["assets/js/invoices.js"]} --> Layouts
| Layout | Used for |
|---|---|
app | Dashboards, apps and most pages: sidebar, top bar with breadcrumb, search, language switch and customizer. Loads Bootstrap, ApexCharts and selaras.js. |
auth | Sign in, sign up and password pages: no sidebar, the form on one side and an optional brand panel on the other. Also loads auth.js. |
error | The 404 and 500 pages: no sidebar, content centered. Also loads error.js. |
store | The buyer-facing store: its own header, cart and footer instead of the admin sidebar. Also loads ecommerce.js and store.js. |
Partials are included in the layout files with {{> name}} on a line of its own, which inserts src/partials/name.html. Page files cannot include partials.
The sidebar menu
The sidebar is defined once, in the NAV constant near the top of build.mjs, and written into every app page by the build — so no two pages can ever show a different menu. NAV is a list of groups; each group has a label and a list of items. A divider is drawn between groups automatically.
To add a link, add an item to the group where it belongs:
{ label: 'Pages', items: [
{ key: 'profile', href: 'pages-profile.html', icon: 'ti-user-circle', text: 'Profile', keys: 'account me my user activity' },
// your new item:
{ key: 'reports', href: 'reports.html', icon: 'ti-report-analytics', text: 'Reports', keys: 'analytics monthly figures' },
…
]}, | Field | What it does |
|---|---|
key | A unique name. A page whose active setting equals this key shows the item as current. |
href | The page the item links to. |
icon | A Tabler icon class, such as ti-report-analytics. All icons are listed on UI Kit › Icons. |
text | The label, also used as the link’s tooltip. |
keys | Optional. Extra search words for the page search on the 404 page (“login” finds Sign in). |
popular | Optional. true lists the page on the 404 page before the visitor types anything. |
sitemap | Optional. false leaves the page out of the 404 page search. |
soon | Optional. true shows the item disabled, with a “Soon” badge. |
To rename, reorder or remove menu items, edit NAV the same way and rebuild. The page search on the 404 page is built from the same list, so it always matches the menu. The documentation menu you see on these pages is a separate list, DOCS_NAV, in the same file.
In the Indonesian pages, a new menu label stays in English until you add its translation to the dictionary.
Cache-busting
The build adds a version to every local stylesheet and script link, for example assets/css/selaras.css?v=1a2b3c4d. The version is taken from the file’s content, so it changes only when the file changes. Browsers then always load the new file after an update instead of an old copy from their cache.
This applies to links in src="…" and href="…" that start with assets/css/, assets/js/ or assets/vendor/ — including the scripts and stylesheets in your page settings. If you change a CSS or JS file, rebuild so the pages pick up the new version.
Code snippets and live examples
Two markers in a page file turn code into a formatted block. Each marker sits on a line of its own:
- Code snippet —
<!--code Label-->, the code, then<!--/code-->. The build shows the code with syntax colors, the label (such asHTMLorTerminal) and a Copy button. Code that starts with a tag is colored as HTML; anything else as JavaScript, CSS or shell. - Live example —
<!--demo-->, the HTML, then<!--/demo-->. The build renders the HTML as a working example and adds Show code and Copy buttons. The code shown is taken from the example itself, so the two never differ. Extra classes for the example box can follow the worddemo.
The buttons need assets/js/components.js in the page’s scripts. Optionally, add <p class="visually-hidden" id="cxLive" aria-live="polite"></p> to the page so screen readers announce “Code copied”.