No input language
Tap a fraction and fill in the boxes. Type 3 then the fraction key and 3 becomes the numerator, like a calculator.
Web component · GCSE and A-level
MathInput lets learners enter fractions, powers, roots, chemical equations and units with a keypad or keyboard, and see them as they would on paper. No LaTeX, no ^, no sqrt(). Your app gets clean LaTeX, text and spoken output.
Designed for students answering questions on phones, tablets and laptops, and for developers who need the answer in a form a computer, or an LLM, can read.
Tap a fraction and fill in the boxes. Type 3 then the fraction key and 3 becomes the numerator, like a calculator.
Every template key is drawn with the same renderer as the answer, with the box the cursor lands in highlighted. An orange corner means "hold for more".
Digits after an element become subscripts, charges and state symbols are one tap, and units stay upright with their own keypad.
Learners can put brackets around work they have already written: type ( before it and ) after, just as on paper.
Every answer comes as LaTeX (with mhchem for chemistry), linear text, spoken English, MathML and a JSON tree. Empty boxes are marked, never lost.
Full keyboard control, a spoken description for screen readers, 44 px touch targets, reduced-motion support and checked colour contrast.
A standard custom element, so it works in plain HTML, React, Vue, Svelte or anything else. A React wrapper is included.
npm install @mathinput/element
Register the element and load the default styles.
Read latex, text or spoken from each input or submit event.
import "@mathinput/element/define";
import "@mathinput/element/mathinput.css";
<math-input subject="maths" label="Answer" submit-on-enter></math-input>
input.addEventListener("submit", (e) => {
send(`Student answer: $${e.detail.latex}$`);
});
Every colour, size, radius and font is a CSS custom property. These are all the same component with different tokens. Read the theming guide or try the skins in the demo.