MorphCanvas
Home › Gallery › Tip Calculator
Reading size:

Tip Calculator

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

★ 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-08-18

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'><input type='number' id='bill' placeholder='Bill amount' min='0' step='0.01'/><div class='buttons'><button data-perc='10'>10%</button><button data-perc='15'>15%</button><button data-perc='20'>20%</button><button data-perc='25'>25%</button></div><div id='result'>Tip: $0.00 | Total: $0.00</div></div>
CSS
body{margin:0;font-family:sans-serif;background:#2c2c2c;color:#fff}.tip-calculator{max-width:300px;margin:20px auto;padding:20px;background:#3a3a3a;border-radius:8px}.tip-calculator input{width:100%;padding:10px;margin-bottom:10px;border:none;border-radius:4px;background:#5a5a5a;color:#fff}.buttons{display:flex;gap:5px;margin-bottom:10px}.buttons button{flex:1;padding:10px;border:none;border-radius:4px;background:#4a4a4a;color:#fff;cursor:pointer}.buttons button:hover{background:#6a6a6a}.tip-calculator #result{font-size:1.1em}
JavaScript
document.addEventListener('DOMContentLoaded',function(){const bill=document.getElementById('bill'),result=document.getElementById('result');function calc(perc){const amt=parseFloat(bill.value)||0;const tip=amt*perc/100;const total=amt+tip;result.textContent=`Tip: $${tip.toFixed(2)} | Total: $${total.toFixed(2)}`}bill.addEventListener('input',()=>calc(15));document.querySelectorAll('.buttons button').forEach(btn=>btn.addEventListener('click',()=>calc(parseFloat(btn.dataset.perc))))});
Build your own on MorphCanvas
Copied to clipboard!