Veylo Docs

HomeDocsJavaScript

JavaScript

veylo.js is optional. It is plain ES5, has no dependencies, and initialises itself on load. It exposes one global, veylo.

API

CallDoes
veylo.themesArray of theme names
veylo.setTheme(name)Sets data-theme on .veylo, sets the page background to --desk, remembers the choice
veylo.theme()Returns the current theme name
veylo.setCaret(name)block, bar, underscore or auto
veylo.sort(th)Sorts the table by the given th[data-sort] header, as if it was clicked

Data attributes

AttributeOnEffect
data-veylo-themeselectTheme picker, fills itself
data-veylo-caretselectCaret picker
data-veylo-maskinputShows * per character; real value in input.dataset.value
data-veylo-sorttableSortable; mark headers with data-sort or data-sort="num"
data-veylo-selecttableRow selection; ="one" for single
data-veylo-modal="#id"buttonOpens that dialog.veylo-dialog
data-veylo-closebutton in a dialogCloses it
data-veylo-staticdialogBackdrop click does not close it
data-veylo-dismissbutton in a note, toast or chipHides it
data-veylo-tabs + data-veylo-tab="#id"tab bar and buttonsTab switching
data-veylo-context="#id"any elementRight-click menu
data-veylo-one.veylo-accsOnly one section open
data-veylo-rate="3".veylo-rateStar rating with initial value
data-veylo-all="name"checkboxSelect-all for checkboxes named name
data-veylo-copy="#id"buttonCopies that element's text
data-value.veylo-color, .veylo-calInitial colour or date

Events

EventWhenDetail
changeA list, table, tree, calendar, rating or colour picker changesvalue, values or items
veylo-openEnter or double-click on a row or leafThe item
veylo-pickA menu item is chosenThe item

document.querySelector('.veylo-color').addEventListener('change', function (e) {
  console.log('colour', e.detail.value);
});

Without the script

Everything visual works without veylo.js. Without it you lose: theme switching helpers, masked inputs, table sorting and selection, the colour picker, calendars, split bars, dialog and tab wiring, and the keyboard behaviour in Keyboard and mouse. Native details, dialog.showModal() and form controls still work.