mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-18 16:08:56 +00:00
* docs(catalog): put each item page's title, description and Docs text in the server HTML Mintlify renders snippet components in the browser only, so everything inside CatalogDetail (title, standfirst, the Docs tab) was missing from the HTML search engines read: 448 catalog pages served Googlebot no body text. The generator now writes the H1 and standfirst as page markup above the component and the Docs tab as page markup after it, shown with that tab (docs/custom.css). The component no longer draws its own title. Pages patched structurally only; registry drift on 14 pages is left for a regeneration of its own. * docs(catalog): keep the title's top spacing the component gave it * fix(docs): catalog titles and descriptions keep markdown markers literal MDX reads text inside the static <h1> and <p> as inline markdown, so @_blue_sweater_ rendered as italic blue_sweater. mdxText now writes backslash, backtick, * _ [ ] ~ as character references too, with a unit test; the four affected pages are re-escaped.
379 lines
16 KiB
Plaintext
379 lines
16 KiB
Plaintext
---
|
|
title: "Typing Indicator"
|
|
description: "The three-dot chat bubble that says someone is writing: it pops in at the thread's edge exactly as messaging apps do, holds while the reply is coming, and vanishes when the message lands"
|
|
mode: "frame"
|
|
---
|
|
|
|
import { CatalogDetail, CatalogSlot } from "/snippets/catalog-detail.jsx";
|
|
import { InstallCommand } from "/snippets/install-command.jsx";
|
|
|
|
<div className="hf-ve-static-head not-prose">
|
|
<h1>Typing Indicator</h1>
|
|
<p>The three-dot chat bubble that says someone is writing: it pops in at the thread's edge exactly as messaging apps do, holds while the reply is coming, and vanishes when the message lands</p>
|
|
</div>
|
|
|
|
<CatalogDetail
|
|
previewSrc="/public/catalog/components/typing-indicator.json"
|
|
compositionId="typing-indicator"
|
|
compositionSrc="compositions/components/typing-indicator.html"
|
|
title="Typing Indicator"
|
|
variables={[{"id":"size","type":"number","role":"style","label":"Size","description":"Bubble width in pixels; dots and tail scale with it.","default":124,"min":80,"max":220,"step":2,"unit":"px"},{"id":"tone","type":"enum","role":"style","label":"Tone","description":"Dark is the reference iOS bubble; light suits bright chat grounds.","default":"dark","options":[{"value":"dark","label":"Dark"},{"value":"light","label":"Light"}]},{"id":"tail","type":"enum","role":"style","label":"Tail","description":"The two shrinking circles anchoring the bubble to the sender side.","default":"on","options":[{"value":"on","label":"On"},{"value":"off","label":"Off"}]}]}
|
|
meta={{"category":"Motion Primitives","badge":"Stable","codeLines":290}}
|
|
attribution={{"author":"Miao Yang","path":"registry/components/typing-indicator","tags":["video-primitive","chat","mock-ui","overlay"]}}
|
|
hasCode
|
|
rawUrl="https://raw.githubusercontent.com/heygen-com/hyperframes/main/registry/components/typing-indicator/typing-indicator.html"
|
|
>
|
|
|
|
<CatalogSlot slot="code">
|
|
|
|
```html typing-indicator.html
|
|
<!--
|
|
Typing Indicator - chat "someone is writing" primitive.
|
|
|
|
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.
|
|
|
|
The bubble pops in exactly as the reference footage does: scale 0.6 to 1 and
|
|
alpha 0.4 to 1 over 0.10s on a power2.out. The reference's dots hold still;
|
|
the optional wave in the integration note is a bounded, seek-safe extra for
|
|
compositions that want the dots to breathe.
|
|
|
|
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.
|
|
|
|
- size (80 to 220, default 124, in px): bubble width. Dots and tail scale
|
|
with it.
|
|
- tone (dark | light, default dark): dark is the reference's iOS-dark
|
|
bubble; light is a pale bubble for bright chat grounds.
|
|
- tail (on | off, default on): the two shrinking circles that anchor the
|
|
bubble to the sender's side.
|
|
|
|
On every default the result matches the measured reference: a 124px dark
|
|
bubble with three 17px dots and a tail.
|
|
-->
|
|
|
|
<div
|
|
data-hf-ui-root
|
|
class="hf-ui-typing-indicator"
|
|
aria-label="Typing indicator"
|
|
data-composition-variables='[
|
|
{ "id": "size", "type": "number", "role": "style", "label": "Size", "description": "Bubble width in pixels; dots and tail scale with it.", "default": 124, "min": 80, "max": 220, "step": 2, "unit": "px" },
|
|
{ "id": "tone", "type": "enum", "role": "style", "label": "Tone", "description": "Dark is the reference iOS bubble; light suits bright chat grounds.", "default": "dark", "options": [{ "value": "dark", "label": "Dark" }, { "value": "light", "label": "Light" }] },
|
|
{ "id": "tail", "type": "enum", "role": "style", "label": "Tail", "description": "The two shrinking circles anchoring the bubble to the sender side.", "default": "on", "options": [{ "value": "on", "label": "On" }, { "value": "off", "label": "Off" }] }
|
|
]'
|
|
>
|
|
<div class="hf-ti-wrap" id="hf-ti-1">
|
|
<div class="hf-ti-bubble">
|
|
<span class="hf-ti-dot"></span>
|
|
<span class="hf-ti-dot"></span>
|
|
<span class="hf-ti-dot"></span>
|
|
</div>
|
|
<div class="hf-ti-tail1"></div>
|
|
<div class="hf-ti-tail2"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<style>
|
|
/* hf-ui:tokens:start */
|
|
/* prettier-ignore */
|
|
[data-hf-ui-root] {
|
|
--_hf-ui-accent: var(--hf-ui-accent, #3ce6ac);
|
|
--_hf-ui-action: var(--hf-ui-action, #eeeeee);
|
|
--_hf-ui-action-contrast: var(--hf-ui-action-contrast, #111111);
|
|
--_hf-ui-border: var(--hf-ui-border, #2a2a2a);
|
|
--_hf-ui-border-strong: var(--hf-ui-border-strong, #383838);
|
|
--_hf-ui-canvas: var(--hf-ui-canvas, #0a0a0a);
|
|
--_hf-ui-control-border: var(--hf-ui-control-border, #686868);
|
|
--_hf-ui-control-border-hover: var(--hf-ui-control-border-hover, #777777);
|
|
--_hf-ui-control-height: var(--hf-ui-control-height, 40px);
|
|
--_hf-ui-danger: var(--hf-ui-danger, #ff7878);
|
|
--_hf-ui-data-1: var(--hf-ui-data-1, #3ce6ac);
|
|
--_hf-ui-data-2: var(--hf-ui-data-2, #63a5ff);
|
|
--_hf-ui-data-3: var(--hf-ui-data-3, #e9ab55);
|
|
--_hf-ui-data-4: var(--hf-ui-data-4, #a78bfa);
|
|
--_hf-ui-data-5: var(--hf-ui-data-5, #ff8a75);
|
|
--_hf-ui-duration-drawer-enter: var(--hf-ui-duration-drawer-enter, 360ms);
|
|
--_hf-ui-duration-drawer-exit: var(--hf-ui-duration-drawer-exit, 240ms);
|
|
--_hf-ui-duration-modal-enter: var(--hf-ui-duration-modal-enter, 280ms);
|
|
--_hf-ui-duration-modal-exit: var(--hf-ui-duration-modal-exit, 180ms);
|
|
--_hf-ui-duration-overlay-enter: var(--hf-ui-duration-overlay-enter, 210ms);
|
|
--_hf-ui-duration-overlay-exit: var(--hf-ui-duration-overlay-exit, 140ms);
|
|
--_hf-ui-duration-press: var(--hf-ui-duration-press, 120ms);
|
|
--_hf-ui-duration-state: var(--hf-ui-duration-state, 160ms);
|
|
--_hf-ui-ease-enter: var(--hf-ui-ease-enter, cubic-bezier(0.32, 0.72, 0, 1));
|
|
--_hf-ui-ease-exit: var(--hf-ui-ease-exit, cubic-bezier(0.23, 1, 0.32, 1));
|
|
--_hf-ui-ease-response: var(--hf-ui-ease-response, cubic-bezier(0.23, 1, 0.32, 1));
|
|
--_hf-ui-font-mono: var(--hf-ui-font-mono, ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace);
|
|
--_hf-ui-font-sans: var(--hf-ui-font-sans, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
|
|
--_hf-ui-hit-target: var(--hf-ui-hit-target, 44px);
|
|
--_hf-ui-radius-control: var(--hf-ui-radius-control, 5px);
|
|
--_hf-ui-radius-overlay: var(--hf-ui-radius-overlay, 10px);
|
|
--_hf-ui-radius-surface: var(--hf-ui-radius-surface, 7px);
|
|
--_hf-ui-shadow-contact: var(--hf-ui-shadow-contact, 0 8px 18px rgba(0, 0, 0, 0.38));
|
|
--_hf-ui-shadow-inset: var(--hf-ui-shadow-inset, inset 0 1px 0 rgba(255, 255, 255, 0.035));
|
|
--_hf-ui-shadow-modal: var(--hf-ui-shadow-modal, 0 18px 46px rgba(0, 0, 0, 0.52));
|
|
--_hf-ui-space-1: var(--hf-ui-space-1, 4px);
|
|
--_hf-ui-space-12: var(--hf-ui-space-12, 48px);
|
|
--_hf-ui-space-16: var(--hf-ui-space-16, 64px);
|
|
--_hf-ui-space-2: var(--hf-ui-space-2, 8px);
|
|
--_hf-ui-space-3: var(--hf-ui-space-3, 12px);
|
|
--_hf-ui-space-4: var(--hf-ui-space-4, 16px);
|
|
--_hf-ui-space-6: var(--hf-ui-space-6, 24px);
|
|
--_hf-ui-space-8: var(--hf-ui-space-8, 32px);
|
|
--_hf-ui-surface: var(--hf-ui-surface, #141414);
|
|
--_hf-ui-surface-inset: var(--hf-ui-surface-inset, #101010);
|
|
--_hf-ui-surface-raised: var(--hf-ui-surface-raised, #1a1a1a);
|
|
--_hf-ui-text: var(--hf-ui-text, #e5e5e5);
|
|
--_hf-ui-text-faint: var(--hf-ui-text-faint, #7e7e7e);
|
|
--_hf-ui-text-muted: var(--hf-ui-text-muted, #929292);
|
|
--_hf-ui-text-strong: var(--hf-ui-text-strong, #f3f3f3);
|
|
--_hf-ui-warning: var(--hf-ui-warning, #e9ab55);
|
|
--_hf-ui-weight-medium: var(--hf-ui-weight-medium, 500);
|
|
--_hf-ui-weight-regular: var(--hf-ui-weight-regular, 400);
|
|
--_hf-ui-weight-semibold: var(--hf-ui-weight-semibold, 600);
|
|
box-sizing: border-box;
|
|
color-scheme: dark;
|
|
font-family: var(--_hf-ui-font-sans);
|
|
}
|
|
/* prettier-ignore */
|
|
[data-hf-ui-root] *,
|
|
[data-hf-ui-root] *::before,
|
|
[data-hf-ui-root] *::after {
|
|
box-sizing: border-box;
|
|
}
|
|
/* prettier-ignore */
|
|
[data-hf-theme="light"] [data-hf-ui-root],
|
|
[data-hf-ui-root][data-hf-theme="light"] {
|
|
--_hf-ui-accent: var(--hf-ui-accent, #087a57);
|
|
--_hf-ui-action: var(--hf-ui-action, #171717);
|
|
--_hf-ui-action-contrast: var(--hf-ui-action-contrast, #ffffff);
|
|
--_hf-ui-border: var(--hf-ui-border, #e0dfdb);
|
|
--_hf-ui-border-strong: var(--hf-ui-border-strong, #cbc9c3);
|
|
--_hf-ui-canvas: var(--hf-ui-canvas, #f6f5f1);
|
|
--_hf-ui-control-border: var(--hf-ui-control-border, #888888);
|
|
--_hf-ui-control-border-hover: var(--hf-ui-control-border-hover, #6f6e68);
|
|
--_hf-ui-danger: var(--hf-ui-danger, #a61b1b);
|
|
--_hf-ui-data-1: var(--hf-ui-data-1, #087a57);
|
|
--_hf-ui-data-2: var(--hf-ui-data-2, #245ea8);
|
|
--_hf-ui-data-3: var(--hf-ui-data-3, #8a4b00);
|
|
--_hf-ui-data-4: var(--hf-ui-data-4, #6d3fc0);
|
|
--_hf-ui-data-5: var(--hf-ui-data-5, #a83d2d);
|
|
--_hf-ui-shadow-contact: var(--hf-ui-shadow-contact, 0 7px 16px rgba(26, 24, 20, 0.13));
|
|
--_hf-ui-shadow-inset: var(--hf-ui-shadow-inset, inset 0 1px 0 rgba(255, 255, 255, 0.78));
|
|
--_hf-ui-shadow-modal: var(--hf-ui-shadow-modal, 0 18px 46px rgba(26, 24, 20, 0.18));
|
|
--_hf-ui-surface: var(--hf-ui-surface, #ffffff);
|
|
--_hf-ui-surface-inset: var(--hf-ui-surface-inset, #f0efeb);
|
|
--_hf-ui-surface-raised: var(--hf-ui-surface-raised, #ffffff);
|
|
--_hf-ui-text: var(--hf-ui-text, #171717);
|
|
--_hf-ui-text-faint: var(--hf-ui-text-faint, #6f6e68);
|
|
--_hf-ui-text-muted: var(--hf-ui-text-muted, #5f5f5a);
|
|
--_hf-ui-text-strong: var(--hf-ui-text-strong, #0a0a0a);
|
|
--_hf-ui-warning: var(--hf-ui-warning, #8a4b00);
|
|
color-scheme: light;
|
|
}
|
|
/* prettier-ignore */
|
|
[data-hf-ui-root]:focus-visible {
|
|
outline: 2px solid var(--_hf-ui-accent);
|
|
outline-offset: 3px;
|
|
}
|
|
/* prettier-ignore */
|
|
[data-hf-rendering="true"][data-hf-ui-root],
|
|
[data-hf-rendering="true"] [data-hf-ui-root],
|
|
[data-hf-rendering="true"][data-hf-ui-root] *,
|
|
[data-hf-rendering="true"] [data-hf-ui-root] *,
|
|
[data-hf-rendering="true"][data-hf-ui-root]::before,
|
|
[data-hf-rendering="true"][data-hf-ui-root]::after,
|
|
[data-hf-rendering="true"] [data-hf-ui-root]::before,
|
|
[data-hf-rendering="true"] [data-hf-ui-root]::after,
|
|
[data-hf-rendering="true"][data-hf-ui-root] *::before,
|
|
[data-hf-rendering="true"][data-hf-ui-root] *::after,
|
|
[data-hf-rendering="true"] [data-hf-ui-root] *::before,
|
|
[data-hf-rendering="true"] [data-hf-ui-root] *::after {
|
|
animation-duration: 0s !important;
|
|
animation-delay: 0s !important;
|
|
transition-duration: 0s !important;
|
|
transition-delay: 0s !important;
|
|
}
|
|
/* prettier-ignore */
|
|
@media (prefers-reduced-motion: reduce) {
|
|
[data-hf-ui-root],
|
|
[data-hf-ui-root] *,
|
|
[data-hf-ui-root] *::before,
|
|
[data-hf-ui-root] *::after {
|
|
animation-duration: 0s !important;
|
|
animation-delay: 0s !important;
|
|
transition-duration: 0s !important;
|
|
transition-delay: 0s !important;
|
|
scroll-behavior: auto !important;
|
|
}
|
|
}
|
|
/* hf-ui:tokens:end */
|
|
|
|
.hf-ui-typing-indicator {
|
|
position: relative;
|
|
display: inline-block;
|
|
}
|
|
.hf-ti-wrap {
|
|
position: relative;
|
|
display: inline-block;
|
|
font-size: var(--hf-ti-size, 124px);
|
|
will-change: opacity, transform;
|
|
}
|
|
.hf-ti-bubble {
|
|
width: 1em;
|
|
height: 0.54em;
|
|
background: var(--hf-ti-surface, #242428);
|
|
border-radius: 0.274em;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 0.081em;
|
|
}
|
|
.hf-ti-dot {
|
|
width: 0.137em;
|
|
height: 0.137em;
|
|
border-radius: 50%;
|
|
background: var(--hf-ti-dot, #8e8e93);
|
|
display: inline-block;
|
|
}
|
|
.hf-ti-tail1 {
|
|
position: absolute;
|
|
left: -0.016em;
|
|
bottom: -0.032em;
|
|
width: 0.145em;
|
|
height: 0.145em;
|
|
border-radius: 50%;
|
|
background: var(--hf-ti-surface, #242428);
|
|
display: var(--hf-ti-tail, block);
|
|
}
|
|
.hf-ti-tail2 {
|
|
position: absolute;
|
|
left: -0.113em;
|
|
bottom: -0.113em;
|
|
width: 0.073em;
|
|
height: 0.073em;
|
|
border-radius: 50%;
|
|
background: var(--hf-ti-surface, #242428);
|
|
display: var(--hf-ti-tail, block);
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
(function () {
|
|
"use strict";
|
|
|
|
var vars =
|
|
window.__hyperframes && window.__hyperframes.getVariables
|
|
? window.__hyperframes.getVariables()
|
|
: {};
|
|
|
|
// Unrecognised overrides return to their declared defaults.
|
|
function pick(table, value, fallback) {
|
|
return Object.prototype.hasOwnProperty.call(table, value) ? value : fallback;
|
|
}
|
|
|
|
function clampNumber(value, min, max, fallback) {
|
|
var n = typeof value === "number" ? value : parseFloat(value);
|
|
if (!isFinite(n)) {
|
|
return fallback;
|
|
}
|
|
return Math.min(max, Math.max(min, n));
|
|
}
|
|
|
|
var tones = {
|
|
dark: { surface: "#242428", dot: "#8e8e93" },
|
|
light: { surface: "#e9e9eb", dot: "#8e8e93" },
|
|
};
|
|
var tails = { on: "block", off: "none" };
|
|
|
|
var size = clampNumber(vars.size, 80, 220, 124);
|
|
var tone = tones[pick(tones, vars.tone, "dark")];
|
|
var tail = tails[pick(tails, vars.tail, "on")];
|
|
|
|
var roots = document.querySelectorAll(".hf-ui-typing-indicator");
|
|
for (var i = 0; i < roots.length; i += 1) {
|
|
roots[i].style.setProperty("--hf-ti-size", size + "px");
|
|
roots[i].style.setProperty("--hf-ti-surface", tone.surface);
|
|
roots[i].style.setProperty("--hf-ti-dot", tone.dot);
|
|
roots[i].style.setProperty("--hf-ti-tail", tail);
|
|
}
|
|
})();
|
|
</script>
|
|
|
|
<!--
|
|
Timeline integration:
|
|
|
|
// pop-in, exactly as measured from the reference
|
|
tl.fromTo('#hf-ti-1', { scale: 0.6, autoAlpha: 0.4 }, { scale: 1, autoAlpha: 1, duration: 0.10, ease: 'power2.out' }, startTime);
|
|
|
|
// optional dot wave (the reference holds still) - bounded repeats keep it seek-safe
|
|
var dots = gsap.utils.toArray('#hf-ti-1 .hf-ti-dot');
|
|
dots.forEach(function (dot, i) {
|
|
tl.to(dot, { y: -6, duration: 0.28, ease: 'sine.inOut', yoyo: true, repeat: 5 }, startTime + 0.1 + i * 0.14);
|
|
});
|
|
|
|
// dismiss
|
|
tl.set('#hf-ti-1', { autoAlpha: 0 }, endTime);
|
|
-->
|
|
```
|
|
|
|
</CatalogSlot>
|
|
|
|
<CatalogSlot slot="install">
|
|
|
|
<InstallCommand command="npx hyperframes add typing-indicator" item="typing-indicator" />
|
|
|
|
That writes one file: `compositions/components/typing-indicator.html`.
|
|
|
|
</CatalogSlot>
|
|
|
|
</CatalogDetail>
|
|
|
|
<div data-static-slot="docs" className="prose prose-gray dark:prose-invert">
|
|
|
|
## Paste it into your composition
|
|
|
|
Open `compositions/components/typing-indicator.html` and copy what is inside into your own composition.
|
|
The file opens with a comment header that walks you through it.
|
|
|
|
A component has no size or duration of its own. It takes both from the composition
|
|
you paste it into.
|
|
|
|
## 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 |
|
|
| --- | --- | --- | --- |
|
|
| `size` | `124` | 80px to 220px, step 2px | Bubble width in pixels; dots and tail scale with it. |
|
|
| `tone` | `dark` | `dark`, `light` | Dark is the reference iOS bubble; light suits bright chat grounds. |
|
|
| `tail` | `on` | `on`, `off` | The two shrinking circles anchoring the bubble to the sender side. |
|
|
|
|
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="typing-indicator"
|
|
data-composition-src="compositions/components/typing-indicator.html"
|
|
data-variable-values='{"size":124,"tone":"dark","tail":"on"}'
|
|
></div>
|
|
```
|
|
|
|
{/* hf:generated-footer */}
|
|
|
|
Tagged `video-primitive` `chat` `mock-ui` `overlay`.
|
|
|
|
Created by Miao Yang.
|
|
|
|
## Related topics
|
|
|
|
- [Browse the complete Catalog](/catalog)
|
|
- [Add assets and Catalog items in the browser editor](/studio/assets-and-blocks)
|
|
- [Put blocks together into one video](/concepts/compositions)
|
|
|
|
</div>
|