> ## Documentation Index
> Fetch the complete documentation index at: https://hyperframes.heygen.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Panel Reveal

> A panel reveal primitive with height expansion and content fade

export const InstallCommand = ({command}) => {
  const [copied, setCopied] = React.useState(false);
  const copy = async () => {
    try {
      if (navigator.clipboard && window.isSecureContext) {
        await navigator.clipboard.writeText(command);
      } else {
        const previous = document.activeElement;
        const scratch = document.createElement("textarea");
        scratch.value = command;
        scratch.setAttribute("readonly", "");
        scratch.style.position = "fixed";
        scratch.style.opacity = "0";
        document.body.appendChild(scratch);
        scratch.select();
        document.execCommand("copy");
        document.body.removeChild(scratch);
        previous?.focus?.();
      }
      setCopied(true);
      setTimeout(() => setCopied(false), 2000);
    } catch {}
  };
  return <div className="hf-install-command not-prose my-4 flex items-stretch overflow-hidden rounded-xl border border-zinc-200 bg-zinc-50 dark:border-zinc-800 dark:bg-zinc-900">
      <code className="flex-1 overflow-x-auto whitespace-nowrap border-r border-zinc-200 px-4 py-3 font-mono text-sm text-zinc-800 dark:border-zinc-800 dark:text-zinc-100">
        {command}
      </code>
      <button type="button" onClick={copy} data-copied={copied ? "true" : "false"} aria-label={`Copy ${command} to the clipboard`} className="hf-install-copy">
        <svg className="hf-install-copy-clipboard" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 18 18" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
          <path d="M14.25 5.25H7.25C6.14543 5.25 5.25 6.14543 5.25 7.25V14.25C5.25 15.3546 6.14543 16.25 7.25 16.25H14.25C15.3546 16.25 16.25 15.3546 16.25 14.25V7.25C16.25 6.14543 15.3546 5.25 14.25 5.25Z" />
          <path d="M2.80103 11.998L1.77203 5.07397C1.61003 3.98097 2.36403 2.96397 3.45603 2.80197L10.38 1.77297C11.313 1.63397 12.19 2.16297 12.528 3.00097" />
        </svg>
        <svg className="hf-install-copy-check" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 18 18" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
          <path d="M2.75 9.5L6.5 13.25L15.25 4.5" />
        </svg>
      </button>
      <span className="hf-install-copy-status" role="status" aria-live="polite">
        {copied ? "Copied" : ""}
      </span>
    </div>;
};

<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 theme={null}
<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 theme={null}
  <!--
    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.

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)


## Related topics

- [Iris Reveal](/catalog/components/iris-reveal.md)
- [ASCII Trail Reveal](/catalog/components/ascii-trail-reveal.md)
- [3D UI Reveal](/catalog/blocks/ui-3d-reveal.md)
