This application uses Svelte 5 Custom Elements to build reusable, interactive components that integrate seamlessly with server-rendered ASP.NET MVC pages.
By compiling Svelte components as Web Components (browser-native custom elements), we achieve clean encapsulation of logic and state while maintaining standards compliance
and framework independence. These calculators demonstrate the approach: each component manages its own reactive state using Svelte's modern Runes syntax, automatically
updating the UI when values change—all without manual DOM manipulation or event wiring. The components work alongside Alpine.js and vanilla JavaScript without conflicts,
can be styled with page-level CSS (via shadow: "none"
), and require only a simple <script>
tag to function. This pattern enables progressive
enhancement of existing pages with sophisticated interactivity while keeping the codebase maintainable and the architecture flexible.
An example of a more comprehensive tool built as a Svelte 5 custom element can be seen in our Values and Grid Art Tool page.