Skip to content
Nana UI

Utilities

Include

Fetches an external HTML file and renders it inline. Loads eagerly by default, or lazy to defer until it scrolls into view.

View .md Download
npm install @nana-tec/ui-components
import "@nana-tec/ui-components/include";
<nana-include src="/fragments/example.html"></nana-include>

Properties

PropertyAttributeTypeDefaultDescription
allowScriptsallow-scriptsbooleanfalseRe-inject and execute any <script> tags from the fetched HTML
lazylazybooleanfalseDefer the fetch until the element scrolls into view
modemodeRequestMode'cors'Fetch CORS mode
srcsrcstring | undefined—URL to fetch

Events

EventDescription
nana-loadFired after the content loads
nana-errorFired on failure (detail.status)
EventTypeDescription
nana-errorCustomEventFired on failure (detail.status)
nana-loadCustomEventFired after the content loads
Explore Include interactively Every state, prop, and edge case — with live controls — in Storybook.
View in Storybook