Authoring guide

Creating & importing charts.

A chart is a small, self-contained interactive learning widget: a quiz, an animation, a simulation, a diagram you can poke at. This guide covers the three ways to make one, the params contract that makes it remixable, and the rules your file must pass to publish.

Last updated: August 24, 2026 Publishing requires Pro Max file size: 1 MB

01 What a chart is

Every chart is a single HTML document that renders inside the Rex app. It should teach or drill exactly one idea, run fully offline, and stay small. The best charts are kinetic. The student learns by doing, not by reading.

Rex charts share one visual language: a light background, black text, and a green accent (#72A07D).

The 60-second version

  1. Write one self-contained HTML file. Everything inline, nothing fetched from the network.
  2. Expose your editable variables on window.__chartParams so others can remix it.
  3. Open Create → Import in the chart store and pick the file.
  4. Fix anything the lint flags as an error, add a title, and publish.

02 Creating charts in the app

Open the Create tab in the chart store. Creating and publishing requires a Pro subscription. You have three authoring paths:

  • Quiz modes. Timed, true/false, multiple choice and type-in. You write question-and-answer cards; Rex renders them through a built-in quiz template. Your questions are the chart's editable variables (see the params contract).
  • Frame Studio. A CapCut-style timeline. Draw, stamp shapes and drop text or question blocks frame by frame; it plays back like a mini video.
  • Import. Bring your own self-contained HTML file. This is the most powerful path, and the rest of this guide is mostly about it.

03 Importing your own HTML

In the Create tab, choose Import and pick an .html file (up to 1 MB). Rex will:

  1. Lint it on-device and show any problems. Errors block publishing; warnings are advisory.
  2. Detect editable variables from your window.__chartParams object.
  3. Preview it through the exact pipeline used in the store, so what you see is what students get.

Add a title, an optional subject and optional tags, then continue to publish. Everything flows through the same review-and-publish step as any other chart.

Imported HTML runs in a sandboxed web view with a strict content-security policy that Rex injects. Your file must be fully self-contained, with no external scripts, stylesheets, fonts or images will load.

04 The params contract

The point of a chart is that it can be remixed. A student (or you) can open the chart's variables and tweak them without touching code. You expose those variables by assigning a single object to window.__chartParams:

Declaring params
<script>
  window.__chartParams = {
    title: "Photosynthesis",
    accentColor: "#72A07D",
    speed: 1.0,
    showLabels: true,
    questions: [
      { q: "What gas do plants take in?", a: "Carbon dioxide" },
      { q: "What gas do plants give off?", a: "Oxygen" }
    ]
  };
</script>

Every top-level key becomes an editable field in Rex's params editor. Rex infers the right control from the value:

ValueEditor control
Text stringText field
"#RRGGBB" stringColor picker
NumberNumber field
BooleanToggle
Array of strings / numbersEditable list
A questions array of { q, a }The study-set / quiz editor

The questions array is the "universal variable". The same shape powers quiz charts, game charts and any imported chart that wants a study set. Read the params back at runtime and render from them:

Reading params at runtime
<script>
  const p = window.__chartParams || {};
  document.body.style.setProperty("--accent", p.accentColor || "#72A07D");
  render(p.questions || []);
</script>
When someone remixes your chart and edits the values, Rex re-injects the edited object as window.__chartParams before your script runs, so your render code needs no changes. Alternatively, place the literal token {{PARAMS}} where a JSON object should go and Rex substitutes the current params there at render time.

05 Declaring field types

Inference is usually enough, but you can override it with the optional reserved __schema key. Keys beginning with __ are hints and are never shown to remixers as plain fields.

__schema overrides
window.__chartParams = {
  speed: 1.0,
  mode: "slow",
  __schema: {
    speed: { type: "slider", label: "Playback speed", min: 0.25, max: 4, step: 0.25 },
    mode:  { type: "select", label: "Difficulty", options: ["slow", "normal", "fast"] }
  }
};

06 Authoring rules & lint

Rex lints every imported file on-device and again on the server. Errors must be fixed or the chart won't publish. Warnings won't block you, but they're worth reviewing.

Error
Self-contained only

No http:// or https:// URLs for scripts, styles, fonts or images. Inline all CSS and JS; embed images as data: URIs or draw them with inline SVG. The only exception is the SVG XML namespace www.w3.org/2000/svg, which the browser never fetches.

Error
Light theme only

No dark hardcoded backgrounds and no prefers-color-scheme dark branches. Use white or soft green tints like rgba(114,160,125,.12).

Error
No emoji

Use inline SVG or text instead.

Warning
Missing viewport meta

Rex injects a <meta name="viewport"> tag, but include your own for an accurate preview.

Warning
No window.__chartParams

The chart will publish, but nobody can remix or edit it.

Warning
File larger than ~300 KB

Trim your inline assets. The hard ceiling is 1 MB.

Good habits

  • Make click targets respond to touch, not just mouse events.
  • Guard canvas first-paint with requestAnimationFrame.
  • Don't put the word "Rex" in user-visible text.

07 Publishing, remixing & moderation

Publishing requires Pro and a one-time agreement to the community guidelines. Once published, your chart is reviewed and anyone can discover, use and remix it. Remixing opens the params editor on a copy, credited back to your original.

You are solely responsible for what you publish. Rex can remove any chart at any time, and reported charts are hidden and reviewed within 24 hours. See the community guidelines for the full content policy.

08 Starter template

Start from a file that already passes the lint and demonstrates the full params contract. Open it in any text editor and edit the params and render code.

chart-starter-template.html

A minimal, valid chart. Self-contained, light theme, params wired up.

Download template