MorphCanvas
HomeGallery › Kilometers ↔ Miles Converter

Kilometers ↔ Miles Converter

Instant conversion between kilometers and miles on a dark-themed card.

★ 0 community votes · Safety scan passed · Sandboxed preview

About this component

Kilometers ↔ Miles Converter 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.

Source

HTML

<div class="converter"><label>Km: <input type="number" id="km" placeholder="0"/></label><label>Miles: <input type="number" id="mi" placeholder="0"/></label></div>

CSS

body{margin:0;background:#1e1e1e;color:#fff;font-family:sans-serif}.converter{display:flex;flex-direction:column;gap:10px;padding:20px;background:#2e2e2e;border-radius:8px;width:250px;margin:50px auto}.converter input{background:#444;border:none;padding:8px;border-radius:4px;color:#fff;width:100%;box-sizing:border-box}

JavaScript

const kmInput=document.getElementById('km'),miInput=document.getElementById('mi');const kmToMi=0.621371;function updateFromKm(){miInput.value=(kmInput.value*kmToMi).toFixed(3)}function updateFromMi(){kmInput.value=(miInput.value/ kmToMi).toFixed(3)}kmInput.addEventListener('input',updateFromKm);miInput.addEventListener('input',updateFromMi);
Build your own on MorphCanvas