"" ""

Embed Tritium as an HTML Element


Embed the Tritium Legal IDE in your existing web platform with a small code snippet.

<input type="file">
<canvas id="tritium-canvas"></canvas>;

<script type="module">
    const tritium = await import("https://tritium.legal/static/init.js");

    // Attach a save handler to receive saved files.
    tritium.setSaveHandler((file) => {
        window.alert(`Saving ${file.size} bytes to: ${file.name}`);
    });

    // Open files in the IDE or by passing a `File` object to `openFile`.
    const input = document.querySelector("input[type=file]");
    input.addEventListener("change", async () => {
        await tritium.openFile(input.files?.[0]);
    });
    
    // Start Tritium with no `files` or `folder` arguments for launch view.
    await tritium.start({settings: {provider: {Tritium: {}}}});
</script>

That's it! The snippet gives you this:

Learn more about our web API in the documentation pages or request source access.