Files
hyperframes/docs/catalog/components/panel-reveal.mdx
T
Miguel Ángel 9734578e60 feat(registry): bring back the video-primitive moves (#3169)
Restores the 208 catalog items reverted after their previews 404'd in
production, this time on the payload mechanism rather than the .html files
that caused the outage.

The generator no longer writes a preview document to docs/public. That writer,
and the machinery under it, existed only to produce files the docs host
discards, so it is gone rather than bypassed. Items now embed the composition
itself via a payload, which is what the previous change already does for the
items that were already in the catalog.

The variables explorer is parked, not restored: it drove its preview through
the same unpublished .html path, so it would have shown an empty frame. Items
that declare variables get the live player plus the static variables table, and
reconnecting the explorer to payloads is a follow-up.
2026-08-10 18:46:03 -04:00

199 lines
8.0 KiB
Plaintext

---
title: "Panel Reveal"
description: "A panel reveal primitive with height expansion and content fade"
---
import { InstallCommand } from "/snippets/install-command.jsx";
<iframe
className="w-full aspect-video rounded-xl border-0 bg-zinc-100 dark:bg-zinc-800"
title="panel-reveal preview"
loading="lazy"
srcDoc={`<!doctype html><html><head><meta charset="utf-8"><style>html,body{margin:0;height:100%;overflow:hidden;background:transparent}hyperframes-player{display:block;width:100%;height:100%}</style><script src="https://cdn.jsdelivr.net/npm/@hyperframes/player@0.7/dist/hyperframes-player.global.js"><\/script></head><body><script>fetch("/public/catalog/components/panel-reveal.json").then(function(r){return r.json()}).then(function(d){var p=document.createElement("hyperframes-player");p.setAttribute("srcdoc",d.html);p.setAttribute("controls","");p.setAttribute("autoplay","");p.setAttribute("loop","");p.setAttribute("muted","");p.setAttribute("poster","https://static.heygen.ai/hyperframes-oss/docs/images/catalog/components/panel-reveal.png");document.body.appendChild(p)});<\/script></body></html>`}
/>
## Install
<InstallCommand command="npx hyperframes add panel-reveal" />
That writes one file: `compositions/components/panel-reveal.html`.
## Variables
Every one of these has a default, so the piece works untouched. Set the ones you
want to change on the element:
| Variable | Default | Accepts | What it does |
| --- | --- | --- | --- |
| `title` | `Motion tokens` | string | The header line that sits above the folded body. |
| `width` | `standard` | `narrow`, `standard`, `wide` | How wide the panel sits, 280, 360 or 480 px. |
| `tone` | `paper` | `paper`, `ink` | Surface family: paper is the white card for light frames, ink inverts it for dark frames. |
| `reveal` | `fade` | `fade`, `solid` | Whether the body fades in with the height. fade is the shipped motion, solid opens the height only. |
Set them with `data-variable-values` on the element that mounts it. These are the
defaults, so this behaves exactly like the preview above until you change one:
```html wrap
<div
data-composition-id="panel-reveal"
data-composition-src="compositions/components/panel-reveal.html"
data-variable-values='{"title":"Motion tokens","width":"standard","tone":"paper","reveal":"fade"}'
></div>
```
## Source
<Accordion title={`panel-reveal.html`}>
```html
<!--
Panel Reveal - transitions.dev-inspired primitive for HyperFrames.
Paste the markup, CSS and script into a composition. Use the timeline
integration note at the bottom as the starting point for deterministic GSAP
animation.
Variables. The script reads each one, falls back to the declared default on
anything missing or unrecognised, and writes the result as a custom property
the CSS below consumes. The timeline recipe at the end is untouched by them:
it keeps driving the single open value from 0 to 1.
- title (string, default "Motion tokens"): the header line above the fold.
- width (narrow | standard | wide, default standard): how wide the panel
sits, 280, 360 or 480 px.
- tone (paper | ink, default paper): the surface family. paper is the
white card on a light frame, ink is the same card inverted for dark
frames, border and body copy included.
- reveal (fade | solid, default fade): whether the body fades in with the
height. fade is the shipped motion, solid keeps the body at full opacity
so only the height opens. Both look the same once the panel is open.
On every default the result is identical to the original: a 360px white card
whose body fades in as it grows.
-->
<section
class="hf-transition-panel-reveal"
data-composition-variables='[
{ "id": "title", "type": "string", "role": "content", "label": "Title", "description": "The header line that sits above the folded body.", "default": "Motion tokens" },
{ "id": "width", "type": "enum", "role": "layout", "label": "Width", "description": "How wide the panel sits, 280, 360 or 480 px.", "default": "standard", "options": [{ "value": "narrow", "label": "Narrow" }, { "value": "standard", "label": "Standard" }, { "value": "wide", "label": "Wide" }] },
{ "id": "tone", "type": "enum", "role": "style", "label": "Tone", "description": "Surface family: paper is the white card for light frames, ink inverts it for dark frames.", "default": "paper", "options": [{ "value": "paper", "label": "Paper" }, { "value": "ink", "label": "Ink" }] },
{ "id": "reveal", "type": "enum", "role": "motion", "label": "Reveal", "description": "Whether the body fades in with the height. fade is the shipped motion, solid opens the height only.", "default": "fade", "options": [{ "value": "fade", "label": "Fade" }, { "value": "solid", "label": "Solid" }] }
]'
>
<header>Motion tokens</header>
<div>
<p>Duration 420ms</p>
<p>Easing power3.out</p>
</div>
</section>
<style>
.hf-transition-panel-reveal {
--hf-panel-open: 1;
width: var(--hf-panel-width, 360px);
overflow: hidden;
border: 1px solid var(--hf-panel-border, #e4e4e7);
border-radius: 14px;
background: var(--hf-panel-surface, #fff);
color: var(--hf-panel-text, #18181b);
font-family: Inter, system-ui, sans-serif;
box-shadow: 0 20px 56px rgba(24, 24, 27, 0.1);
}
.hf-transition-panel-reveal header {
padding: 15px 17px;
font-weight: 900;
}
.hf-transition-panel-reveal div {
max-height: calc(var(--hf-panel-open) * 120px);
opacity: calc(1 - var(--hf-panel-fade, 1) * (1 - var(--hf-panel-open)));
padding: 0 17px calc(var(--hf-panel-open) * 17px);
overflow: hidden;
}
.hf-transition-panel-reveal p {
margin: 0 0 8px;
color: var(--hf-panel-muted, #71717a);
font-size: 14px;
}
</style>
<script>
(function () {
"use strict";
var vars =
window.__hyperframes && window.__hyperframes.getVariables
? window.__hyperframes.getVariables()
: {};
// Unrecognised overrides return to their declared defaults.
var widths = { narrow: "280px", standard: "360px", wide: "480px" };
var tones = {
paper: {
surface: "#fff",
border: "#e4e4e7",
text: "#18181b",
muted: "#71717a",
},
ink: {
surface: "#18181b",
border: "#3f3f46",
text: "#fafafa",
muted: "#a1a1aa",
},
};
var reveals = { fade: 1, solid: 0 };
function pick(table, value, fallback) {
return Object.prototype.hasOwnProperty.call(table, value) ? value : fallback;
}
var width = widths[pick(widths, vars.width, "standard")];
var tone = tones[pick(tones, vars.tone, "paper")];
var fade = reveals[pick(reveals, vars.reveal, "fade")];
var title = typeof vars.title === "string" ? vars.title.trim() : "";
if (!title) {
title = "Motion tokens";
}
var roots = document.querySelectorAll(".hf-transition-panel-reveal");
for (var i = 0; i < roots.length; i += 1) {
var root = roots[i];
root.style.setProperty("--hf-panel-width", width);
root.style.setProperty("--hf-panel-surface", tone.surface);
root.style.setProperty("--hf-panel-border", tone.border);
root.style.setProperty("--hf-panel-text", tone.text);
root.style.setProperty("--hf-panel-muted", tone.muted);
root.style.setProperty("--hf-panel-fade", String(fade));
var header = root.querySelector("header");
if (header) {
header.textContent = title;
}
}
})();
</script>
<!--
Timeline integration:
tl.fromTo('.hf-transition-panel-reveal', { '--hf-panel-open': 0 }, { '--hf-panel-open': 1, duration: 0.44, ease: 'power3.inOut' }, startTime);
-->
```
</Accordion>
## Usage
Open `compositions/components/panel-reveal.html` and paste its contents into your composition. See the comment header in the file for detailed instructions.
{/* hf:generated-footer */}
Tagged `transition-primitive` `transitions-dev-port` `panel` `reveal`.
## Related topics
- [Browse the complete Catalog](/catalog)
- [Add assets and Catalog items in Studio](/studio/assets-and-blocks)
- [Build a richer composition](/go-further)