Skip to content

Frameworks

A custom element is just a DOM element, so there is no wrapper package to install and nothing to keep in step with your framework’s release cycle. The only thing that differs between frameworks is how you set a property that isn’t a string.

<script type="module">
import 'fileon';
</script>
<file-preview src="/report.pdf" name="Q3 report.pdf" bordered></file-preview>

The package touches document at import time to register the elements, so import it in a client-only path: a useEffect, an onMount, a dynamic import(), or Astro’s client:only. The markup itself is inert until the definition arrives, so the page will not flash broken content.

// Next.js app router
'use client';
import { useEffect } from 'react';
useEffect(() => {
import('fileon');
}, []);