MorphCanvas
Home › Gallery › Tip Calculator
Reading size:

Tip Calculator

A compact tip calculator with bill input and preset percentage buttons, styled for dark mode.

★ 0 community votes · Safety scan passed · Sandboxed preview
Listen to Component Overview (AI Narration)
Viewport:
Backdrop:
Safety Scan
Verified Safe (0 Violations)
Sandbox Isolation
Active (allow-scripts)
Code Dependencies
Zero / Standalone Vanilla
Last Synthesized
2026-09-14

About this component

Tip Calculator is an interface component generated on MorphCanvas, an infinite AI workspace that turns written intent into reviewable HTML, CSS, and JavaScript widgets. This component passed MorphCanvas’s automated safety scan, which checks for unsafe patterns such as external network calls, storage access, inline event handlers, and code execution, and it is rendered here inside a sandboxed preview frame.

How it was built

A creator described the result they wanted, MorphCanvas routed the request through its AI provider chain with automatic failover, scanned the generated code, and published the reviewed component to the public library. You can build and publish your own components on the MorphCanvas canvas.

Community Evaluation & Feedback

How would you characterize this AI-generated component for your projects?

Select an evaluation tag above to record your vote.

Source Code

HTML
<div class="tip-calculator"><label for="bill">Bill Amount</label><input type="number" id="bill" min="0" step="0.01" placeholder="0.00"><div class="buttons"><button data-perc="10">10%</button><button data-perc="15">15%</button><button data-perc="20">20%</button></div><div class="result"><span id="tip">Tip: $0.00</span></div></div>
CSS
body{margin:0;font-family:Arial,sans-serif;background:#121212;color:#fff}.tip-calculator{max-width:300px;margin:2rem auto;padding:1rem;background:#1e1e1e;border-radius:8px}.tip-calculator label{display:block;margin-bottom:.5rem}.tip-calculator input{width:100%;padding:.5rem;border:none;border-radius:4px;background:#2e2e2e;color:#fff;margin-bottom:.5rem}.buttons{display:flex;gap:.5rem;margin-bottom:.5rem}.buttons button{flex:1;padding:.5rem;border:none;border-radius:4px;background:#3a3a3a;color:#fff;cursor:pointer}.buttons button:hover{background:#4a4a4a}.result{font-size:1.2rem;text-align:center}
JavaScript
document.addEventListener('DOMContentLoaded',()=>{const billInput=document.getElementById('bill');const tipDisplay=document.getElementById('tip');const buttons=document.querySelectorAll('.buttons button');const updateTip=perc=>{const bill=parseFloat(billInput.value)||0;const tip=bill*perc/100;tipDisplay.textContent=`Tip: $${tip.toFixed(2)}`};buttons.forEach(btn=>{btn.addEventListener('click',()=>updateTip(parseFloat(btn.dataset.perc)))});billInput.addEventListener('input',()=>updateTip(0))});
Build your own on MorphCanvas
Copied to clipboard!