Skip to content

JavaScript API

Sprout exposes a small set of methods on the Sprout object. The full reference is in the Reference section.

See JavaScript API for:

  • init — auto-called when the script loads; registers custom elements and event delegation
  • setTheme, getTheme, toggleTheme — theme control
  • toast(message, options) — transient notifications
  • tooltip(element, text, options) — programmatic tooltips

Modals, dismissible alerts, copy button, nav and sidebar collapse, tabs, and dropdowns are driven by markup and do not require API calls once the script is loaded.

MIT License · Lightweight by principle. Sustainable by design.