You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pure JavaScript UI component library. No dependencies, no frameworks.
Part of the Olevsoft toolset — used in production by
IMS2, a warehouse management system
(live demo, login admin / USR).
See also PForm2 (report engine) and
IMSD (desktop distribution).
// Types — visual stylebtn.setType('primary');// blue, main actionbtn.setType('danger');// red, destructivebtn.setType('success');// green, confirmationbtn.setType('warning');// orange, cautionbtn.setType('default');// gray, secondary// Sizesbtn.setSize('small');btn.setSize('large');// Function key hint — shows "[F2]" after labelbtn.setFKey('F2');// Disabled statebtn.setDisabled(true);
API
Prop
Type
Default
Description
text
string
''
Button label
type
string
'default'
'default''primary''danger''success''warning'
size
string
'medium'
'small''medium''large'
fKey
string
—
Function key hint
disabled
bool
false
Disabled state
Method
Description
setText(text)
Set label
getText()
Get label (includes fKey)
setType(type) / getType()
Set/get visual style
setSize(size)
Set size ('small''medium''large')
setFKey(key)
Show function key hint
setDisabled(bool)
Enable/disable
isDisabled()
Check if disabled
click()
Programmatic click
Input
Text input field.
When to use
Single-line text entry (name, email, search)
Numeric input (quantity, price)
Basic usage
constname=newInput('text','Enter name');name.setValue('John');name.on('change',({ value })=>{console.log('Typed:',value);// fires on every keystroke});
combo.setAsyncSearch(async(query)=>{constres=awaitfetch(`/api/search?q=${query}`);returnawaitres.json();// must return [{value, label}]});combo.setMinChars(2);// start searching after 2 charscombo.setDebounce(300);// wait 300ms after typing stops
constdp=newDatePicker('Select date');dp.setValue('2026-06-25');dp.setMinDate('2026-01-01');dp.setMaxDate('2026-12-31');dp.on('change',({ value })=>console.log(value));// "2026-06-25"
Dialog.alert('Error','Something went wrong');Dialog.confirm('Delete this item?',()=>deleteItem());
Stacking
Dialogs auto-stack: each new dialog gets a higher z-index and cascades 36px down-right.
API
Prop
Type
Default
Description
title
string
''
Dialog title
size
string
'medium'
'small''medium''large'
closable
bool
true
Show close button
fillSpace
bool
false
Remove content padding
closeOnBackdrop
bool
false
Close by clicking backdrop
customWidth
string
—
Custom width
customHeight
string
—
Custom height
debugId
string
—
Debug label
Method
Description
setTitle(text)
Title
setContent(el) / appendContent(el)
Body content
getHeader()
Header element
setHeaderContent(el)
Custom header content
getFooter()
Footer element (add buttons here)
setWidth(w) / setHeight(h)
Dimensions
setSize(size)
'small''medium''large'
setClosable(bool)
Show/hide close button
setFillSpace(bool)
Remove content padding
setDebugId(id)
Debug label
setFKeys(map)
Keyboard shortcuts {key: fn}
show() / hide() / close()
Show/hide
Static Method
Description
Dialog.alert(title, message)
Quick alert dialog
Dialog.confirm(title, onConfirm, onCancel)
Quick confirm dialog
Event
Payload
close
{}
Panel
Panel with header, body, and footer. Can collapse.
constpanel=newPanel('Settings');panel.setContent(someElement);panel.getFooter().appendChild(saveBtn.element);panel.setCollapsible(true);panel.setCollapsed(true);// initially collapsedpanel.toggleCollapsed();// toggle state
Simple table without sorting or pagination. For small datasets.
consttable=newTable();table.setHeaders(['Name','Email','Age']);table.setRows([['John','john@test.com',30],['Jane','jane@test.com',25],]);table.on('rowselect',({ index, data })=>console.log(data));
Component height and text size are driven by a separate set of tokens from
color/theme — every theme (modern.css, beige.css, gruvbox.css,
linear.css) declares the same values, so overriding them centrally in your
app stylesheet (loaded after the theme <link>) rescales Input, Select,
Combo, Dropdown, DatePicker and Grid row/header height together,
without touching any theme file:
:root{--size-sm:clamp(1.5rem,3vw,1.75rem);/* small controls */--size-md:clamp(2rem,3vw,2.1rem);/* default control height, incl. Grid rows */--size-lg:clamp(2.5rem,4vw,2.6rem);/* large controls */--font-size-small:clamp(0.75rem,0.8vw+0.15rem,0.85rem);--font-size-base:clamp(0.875rem,1vw+0.2rem,0.95rem);--font-size-large:clamp(1rem,1.2vw+0.2rem,1.1rem);--padding-xs:clamp(0.2rem,0.5vw,0.3rem);--padding-sm:clamp(0.4rem,1vw,0.5rem);--padding-lg:clamp(1rem,2vw,1.15rem);}
Dialog header padding, footer button height and the close-button size are a
separate small set of tokens (--dlg-header-pad-v/-h, --btn-height,
--dlg-close-size, --btn-padding, --btn-font) for the same reason —
Dialog markup is shared by every theme but its chrome isn't part of the
--size-* scale.
A consuming app can expose 2–3 named presets (e.g. Compact / Normal /
Comfortable) by scoping these overrides under a class on <html> and
toggling it at runtime — this is exactly how IMS2's own density switcher
(login screen, top-right) works; see app.css (html.density-normal,
html.density-comfortable) and density.js in the IMS2 repo for a full
worked example, including the localStorage + FOUC-safe pre-apply pattern
also used for theme selection.
Base Class
All components extend Base. These methods are available on every component.
component.element// native HTMLElementcomponent.append(child)// add child (Base or HTMLElement)component.clear()// remove all childrencomponent.destroy()// destroy component + childrencomponent.addClass('my-class')component.removeClass('my-class')component.setStyle('color','red')component.setProperty('key',value)component.getProperty('key',defaultValue)component.on('change',handler)component.off('change',handler)component.emit('change',{value: 42})component.show()component.hide()component.isVisible()component.beginUpdate()// ... multiple changes ...component.endUpdate()// single render