Small tools · Native web components

A little arithmetic.

A familiar desk calculator, rebuilt with the browser’s own components. No framework, build step, or server.

One element. Its own state.

This is an adaptation of my original React calculator, made with AI assistance. The four-column keypad and basic operations carry over; the new version adds keyboard controls, clear, sign change, deletion, and explicit error handling.

Import native-calculator/calculator.js as a module, then add <andur-calculator></andur-calculator>. Each instance owns its state and uses Shadow DOM to keep its styles contained.

Operations run left to right: 2 + 3 × 4 = 20. Equals completes the pending operation; pressing it again does not repeat it. Displayed results are rounded to 15 significant digits using JavaScript numbers; this is not a financial-precision calculator.