Quick start
-
Add a loader where the answer will appear.
No build step needed: paste this into any HTML page.
<script src="https://cdn.jsdelivr.net/npm/mulling@1/dist/mulling.umd.js"></script><script>Mulling.defineElement();</script><mulling-status state="thinking"></mulling-status>After
npm install mulling, with a bundler such as Vite:import { mount } from 'mulling';const loader = mount(document.querySelector('#status'), { state: 'thinking' });import { Mulling } from 'mulling/react';<Mulling state={status} /><script setup>import { Mulling } from 'mulling/vue';</script><template><Mulling :state="status" /></template> -
Change the state as your AI works:
thinking,searching,writing, thendoneorerror. The loader cross-fades between them, and screen readers hear each change once.const loader = document.querySelector('mulling-status');loader.setAttribute('state', 'writing'); // when the first words arriveloader.update({ state: 'writing' }); // when the first words arriveconst [status, setStatus] = useState('thinking');// when the first words arrive:setStatus('writing');const status = ref('thinking');// when the first words arrive:status.value = 'writing';Try it: this is a pretend response going through every state.
Press “Ask” to start. -
Swap in the answer when it’s ready. “Done” is still spoken after the loader is removed; see Endings.
That’s all most apps need. Next:
- Stream a response: the whole flow wired to a real
fetch(), with errors handled. - AI states: pick the loader and words for each state.
- Loaders and playground: try every option and copy the code.