Bundleware, Toolbar Script Reference

Last site update 29th October 2026

Components and hooks

JSX works as in React, with a few points worth knowing:

React's hooks follow React's rules: useState, useReducer, useEffect, useLayoutEffect, useRef, useMemo and useCallback. The toolbar hooks:

HookReturns
useToolbar()This mount's context: timers, listeners, windows, popups, page and local AI.
useStore(store)[value, setValue] for a store, like useState shared by the toolbar, its widgets and windows.
usePage({ maxLength? })The page { url, title, text, selection }, re-rendering after changes.
useActivity(), useAiSite()The activity list and AI-site snapshot, re-rendering after changes.
useSpeech(){ speaking, available, speak(text, options?), stop() }; see speech.
useSound({ onEnd? }), useLevels(count?, options?)A deck of the toolbar's music and the levels of its sound; see sound.
useGenerate(){ run(request), cancel(), busy, result, error, cancelled }; see local AI.
useRoot()The element a widget or window renders into. Rarely needed, for example to find the band with useRoot().closest('.bundle-bar').

Two components cover common shapes inside widgets:

Effects and cleanup. Anything created through the context or the toolbar hooks ends with the mount, so most components need no cleanup at all. Effect cleanups run when a component unmounts too, but a useEffect cleanup can run a moment later; use useLayoutEffect when something must stop before the mount finishes ending, such as removing an attribute you set on the band.