Skills › HyperFrames › hyperframes-registry › demo-html-pattern.md
demo-html-pattern.md
54 lines · skills/hyperframes-registry/references/demo-html-pattern.md at a595755
The demo.html Convention
Raw lines 1 to 23## Why components ship demo.html
5Every component in the registry ships a companion `demo.html` file alongside its snippet. The demo serves two purposes:
71. **Preview fixture** — the CI preview pipeline renders the demo to generate thumbnail images and preview videos for the catalog docs page.
92. **Usage example** — the demo shows the component effect applied to representative content, serving as a working reference.
Why components ship demo.html
Every component in the registry ships a companion demo.html file alongside its snippet. The demo serves two purposes:
- Preview fixture — the CI preview pipeline renders the demo to generate thumbnail images and preview videos for the catalog docs page.
- Usage example — the demo shows the component effect applied to representative content, serving as a working reference.
11## Demo structure
13A demo is a complete, standalone HTML composition:
15```html
16<!doctype html>
17<html lang="en">
18 <head>
19 <meta charset="UTF-8" />
20 <meta name="viewport" content="width=1920, height=1080" />
21 <title>Component Name — Demo</title>
22 <script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
23 <style>
24 /* reset + canvas size */
25 </style>
26 </head>
27 <body>
28 <div data-composition-id="<name>-demo" data-width="1920" data-height="1080" data-duration="N">
29 <!-- Demo content showing the effect -->
30 <!-- Component snippet inlined here -->
31 </div>
32 <script>
33 // GSAP timeline demonstrating the effect
34 window.__timelines = window.__timelines || {};
35 window.__timelines["<name>-demo"] = tl;
36 </script>
37 </body>
38</html>
39```
41Key conventions:
43- `data-composition-id` is `<component-name>-demo` to avoid collisions
44- The demo is self-contained — all CSS and JS from the snippet is inlined
45- The GSAP timeline is registered on `window.__timelines`
46- Duration should be long enough to showcase the effect (typically 5-8 seconds)
Demo structure
A demo is a complete, standalone HTML composition:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=1920, height=1080" />
<title>Component Name — Demo</title>
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
<style>
/* reset + canvas size */
</style>
</head>
<body>
<div data-composition-id="<name>-demo" data-width="1920" data-height="1080" data-duration="N">
<!-- Demo content showing the effect -->
<!-- Component snippet inlined here -->
</div>
<script>
// GSAP timeline demonstrating the effect
window.__timelines = window.__timelines || {};
window.__timelines["<name>-demo"] = tl;
</script>
</body>
</html>Key conventions:
data-composition-idis<component-name>-demoto avoid collisions- The demo is self-contained — all CSS and JS from the snippet is inlined
- The GSAP timeline is registered on
window.__timelines - Duration should be long enough to showcase the effect (typically 5-8 seconds)
48## Blocks don't need demo.html
50Blocks are already standalone compositions that can be rendered directly. Only components need the demo wrapper.
Blocks don't need demo.html
Blocks are already standalone compositions that can be rendered directly. Only components need the demo wrapper.
Raw lines 48 to 5152## Demos are not installed
54The `demo.html` is NOT installed by `hyperframes add` — it exists only in the registry for preview generation and as a reference.
Demos are not installed
The demo.html is NOT installed by hyperframes add — it exists only in the registry for preview generation and as a reference.