JavaScript API
Optional. The CSS works alone; arekui.js adds behaviour on top of it - modals, drawers, tabs, accordions, toasts, ratings, popovers, file uploads and the theme API. Everything hangs off the ARStyle global.
Load the script
<script src="arekui.js"></script>ARStyle methods
| Method | What it does |
|---|---|
setTheme(name) | Switch theme: light, dark or neo |
getTheme() | Current theme name |
initTheme() | Apply the stored / system theme |
init() | Bind all components (runs on load) |
toast(msg, opts) | Show a toast: type, duration, icon |
dismissToast() | Dismiss the active toast |
setRating(el, n) | Set a rating widget's value |
getRating(el) | Read a rating widget's value |
openPopover(id) | Open a popover by id |
closePopover(id) | Close a popover by id |
Toast from anywhere
ARStyle.toast("Saved!", { type: "success", duration: 3000 });Types: default, success, info, warning, error.
TypeScript
Types are included
import ARStyle from "arekui";
ARStyle.setTheme("dark");
ARStyle.toast("Hello", { type: "info" });arekui.d.ts ships with the package - full autocomplete in VS Code.