Templates
Lume leverages the browser’s native <template> element for dynamic content creation — no custom template syntax needed.
How It Works
Section titled “How It Works”- Define a
<template>element withdata-lume-partinside your component root - Use
template(name)in your component to get a factory function - Call the factory to clone the template content
HTML Setup
Section titled “HTML Setup”Component Logic
Section titled “Component Logic”Why Native Templates?
Section titled “Why Native Templates?”- Performance:
<template>content is parsed but not rendered until cloned - No string parsing: Unlike innerHTML, templates are parsed by the browser natively
- Standard: Uses the platform’s built-in
<template>element — no library-specific syntax - Type-safe: You get full DOM API access on the cloned content