MorphCanvas
Home › Gallery › Km-Mi Converter
Reading size:

Km-Mi Converter

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

★ 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-10-10

About this component

Km-Mi 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.

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="converter-card"><h2 class="title">Kilometers ↔ Miles</h2><div class="input-group"><label for="km">Kilometers</label><input id="km" type="number" step="any" placeholder="0"/></div><div class="input-group"><label for="mi">Miles</label><input id="mi" type="number" step="any" placeholder="0"/></div></div>
CSS
.converter-card{background:#1e1e1e;color:#e0e0e0;font-family:Arial,Helvetica,sans-serif;padding:20px;border-radius:8px;width:280px;box-shadow:0 2px 10px rgba(0,0,0,.5)}.converter-card .title{margin:0 0 15px;font-size:1.2em;text-align:center} .converter-card .input-group{display:flex;flex-direction:column;margin-bottom:10px} .converter-card label{font-size:.9em;margin-bottom:4px} .converter-card input{padding:6px 8px;border:none;border-radius:4px;background:#2e2e2e;color:#e0e0e0;font-size:1em} .converter-card input:focus{outline:2px solid #4a90e2}
JavaScript
const km=document.getElementById('km'),mi=document.getElementById('mi');const factor=0.621371;function kmToMi(v){return v*factor}function miToKm(v){return v/factor}km.addEventListener('input',()=>{const val=parseFloat(km.value);mi.value=val?kmToMi(val).toFixed(4):''});mi.addEventListener('input',()=>{const val=parseFloat(mi.value);km.value=val?miToKm(val).toFixed(4):''});
Build your own on MorphCanvas
Copied to clipboard!