Skip to content
A vanilla Minecraft field guideBlockBrain

The field notes / design reference

Embed design.

BlockBrain design reference for embeds: the Embed dialog, embed pages, code, sizes and themes.

11 / Embeds

A widget that travels.

The Embed dialog

Open Embed to configure a real interactive iframe preview and copy its matching code.

  • On desktop put the preview on the left and the configuration controls, generated code and Copy action on the right.
  • Keep the preview first in the DOM; at narrow widths stack the controls below it.
  • The desktop controls column scrolls independently so changing options does not move the preview.
  • Offer blueprint-only or farm-and-instructions contents and explicit width and height; the preview fits the available width, just as the copied responsive iframe does.
  • Keep the modal frame and preview space reserved without moving or resizing the catalogue.
  • Load the iframe only while the dialog is open and remove it on close.
  • Embed choices are local to the dialog and do not change the source card.

Embed dialogs set the widget's own edition and game version, and a villager trade embed also its biome, so a host can show any pinned version; older versions use the /v/<version>/ address.

Place the embed Contents choice above the preview frame on the right as two grouped icon buttons: a wireframe cube for Blueprint only and a checklist for Farm and instructions.

  • Use 44 px square targets with reserved 24 px icons, accessible names, native title tooltips and a visible selected state.
  • Keep their compact width stable on desktop and narrow screens, including hover, focus and selection changes.
  • These control the embedded content view; selectors inside the embedded farm remain below its blueprint.

Embed documents and footer

Embed documents own their canvas, body and application surface using the selected theme's paper and ink tokens.

Every embed opens with the name of what it shows, as its one h1: the farm, recipe, trader, drop source or Block heights. A farm's name links to its page here in a new tab. Hovering a card's Embed button marks what the embed shows with one border around the title and the picture or widget together, never a box for each. The border is drawn over the card, so nothing moves.

  • Blueprint-only mode unwraps card ancestors with display: contents, so their painted background cannot be relied on.
  • Keep the main site's decorative body texture out of both blueprint-only and farm-and-instructions embeds, including wide iframe gutters.
  • Embedded 2.5D viewers keep the same dimetric angles, block scale and left-side light as the site. Preserve the scene’s own terrain and sky backgrounds and keep theme changes independent of the host page’s appearance.

Strip site-only side borders, outer shadows and content-width caps from farm embed documents.

  • Use even padding on all four sides in each embed mode; the surrounding site's frame must not appear on only the left and right.
  • The preview places the real iframe between static block-style text lines with a readable article heading.
  • The sample host page stays white with neutral dark text in either dialog theme; decorative text lines are hidden from assistive technology.
  • The iframe uses its independently selected theme and configured CSS dimensions.
  • Scroll the sample page locally and preserve the preview viewport during option changes.

Every embed, including trading and blueprint-only views, uses the same minimal footer row: the linked BlockBrain mark and wordmark on the left and version metadata on the right.

  • Farms and their blueprints show the selected farm’s revision and date; trading shows the site build number and release date because it has no per-entity revision counter.
  • Keep the revision in this footer only, synchronized with the selected specialization.
  • Use a reserved 18 × 20 px mark, the shared wordmark font and a 44 px link target.
  • Never wrap the footer; at narrow embed widths, hide the visible brand name while preserving the mark and the full accessible link name.
  • The footer sits at the viewport bottom when content is short and follows longer content in normal flow, without covering instructions.
  • Use theme tokens and keep the attribution inside the widget rather than duplicating it in the sample host page.

Copy image writes a PNG of the current widget to the clipboard; Save PNG provides a download when image copying is unavailable or blocked.

  • Capture the live widget's theme, resolved preview width, camera and operation state, full content and brand credit, without the sample article or authoring controls.
  • Preserve the live page's geometry and scroll position while exporting, reserve status space and keep both actions at least 44 px high.
  • Image rendering loads only when requested and runs locally; very large exports are bounded to avoid excessive canvas memory.
  • This is a static image, not an interactive embed.

Code and parameters

Show generated embed source in a fixed-height, vertically scrolling code block with line numbers and theme-aware syntax colors.

  • Keep HTML attributes on separate lines.
  • Soft-wrap long lines, including URLs, within the available width; give each original source line one number aligned with its first visual row.
  • Continuation rows do not add numbers or source newlines.
  • Preserve exact source text and exclude line numbers from copying; keyboard Select all stays within the focused code block.
  • Render tokens as escaped text nodes, never executable markup.
  • Farm, trading and variable-template embeds share this component.

Validate sizes as bounded CSS data before browser validation: reject comments, declaration separators, control characters, markup and executable expressions.

  • Validate selectors against their offered choices.
  • Escape generated HTML attributes and template metacharacters; allow only HTTP(S) iframe targets without credentials.
  • Treat entered text as data, never instructions, and keep invalid drafts out of the preview and copied code.
  • The controls do not invoke an AI model.

Put browser-only embed settings (view, theme, layout, auto height and trading selections) after # in the URL.

  • Keep the static document identity in its path.
  • Read legacy query settings as a fallback; fragment values take precedence.
  • Changing a preview setting updates the existing document without requesting its HTML again.
  • Keep ordinary section anchors and legacy route bookmarks working.
  • Treat fragments as untrusted data with the same validation as query parameters.

Show the theme variable contract beside the template instructions: type string, with exact quoted values "day", "night", "cloud", "stone", "coal" and "auto" and their appearance behavior.

  • Explain that values are lowercase and case-sensitive and that other values follow the system theme.
  • Derive the reference from the same typed option metadata used by the generated JavaScript/server-template comments, keeping it visible without expansion in either template format.

Size and theme

Keep embed Width and Height compact: pair each short editable input with a slider indexed to common pixel sizes, 100% and auto.

  • Default Height to auto: fit the complete widget document without an internal scrollbar, including instructions, attribution and changes in width or content.
  • Include the static embed-resize.js host helper in copied auto-height markup and opt the iframe into the versioned height-message protocol.
  • Validate both message origin and source window and accept bounded numeric heights only.
  • Width auto retains intrinsic CSS sizing.
  • Bare numbers mean pixels; accept browser-supported CSS sizes such as rem, vh, calc() and percentages.
  • Fixed heights remain explicit overrides; percentages depend on the containing block.
  • Retain the last valid size while an entry is incomplete, reserve validation space and keep the modal's preview viewport stable and locally scrollable.

Embed Theme initially matches the current appearance.

  • Use a grouped button selector for Day, Night, Cloud (Neutral White), Stone (Neutral Gray), Coal (Neutral Dark Mode), Auto and Variable-driven.
  • Reserve 44 px targets, show selected state and small palette swatches, and keep descriptive tooltips from shifting the layout.
  • Neutral themes use achromatic surfaces, text and controls while item artwork and semantic colors remain intact.
  • Variable-driven embeds offer JavaScript and server-side template code with an explicit theme-variable insertion point.
  • Show the same grouped palette buttons, including Auto, for the variable preview; do not substitute that example value into the copied variable template.
  • JavaScript validates the theme, constructs the fragment with URLSearchParams and prepares dimensions as named values before a short final iframe template.
  • Keep configuration and logic outside markup strings, escape attributes at the HTML boundary, and load the auto-height helper once with a real script element so dynamic insertion works; server placeholders must be replaced with the host template engine's URL-encoded and HTML-escaped value.
  • Supported fixed values are day, night, cloud, stone and coal; auto and other values use the system appearance.
  • Explicit iframe themes do not read or overwrite the saved site theme.
  • Without a theme parameter, existing embeds retain their saved/system appearance behavior.

Variants and residents

Embed specialization and variant controls use the same selector component, labels, icons and selected states as the source farm.

  • Keep icon-and-name buttons for small sets and the synchronized single scrolling icon row plus named dropdown for sets larger than eight.
  • Authoring controls belong in the right column on desktop and below the preview on narrow screens, always after the preview in the DOM.
  • Farm selectors inside the embedded content retain their blueprint-first order.
  • Keep authoring selection local to the dialog and update its iframe and copied URL together.

For constructed farm residents, show summoning materials as a construction stage and the living entity only afterward.

  • Count the original inputs once: a copper block and carved pumpkin create the golem and its reusable copper input chest.
  • Show enclosure sides and roof, retain separate positioning methods below the blueprint, and keep optional waxing out of required materials.
  • Resident and minecart overlays do not contribute placed-block counts.

Privacy & analytics

Your saved settings, plans and blueprint drafts stay in this browser.

Usage analytics are on by default. They help us see which pages and tools people use. We use two services: PostHog and Google Analytics. You can turn both off here at any time. Your on or off choice is saved in this browser.

PostHog uses no cookies and stores no ID in your browser. It makes a random-looking ID on its servers, and it changes every day. That lets us count visits without knowing who you are. To make the ID, PostHog reads your IP address and the long text your browser uses to describe itself. Then it throws them away.

What we send to PostHog:

Widgets from this site can show up on other websites. They send PostHog the same kind of data, plus the name of that website. Google Analytics does not run in widgets.

Google Analytics gets the address and title of the page you opened, the address of the page that sent you here, your browser, system, device type, screen size and language, and about where you are, like your country and city. It also counts scrolling to the bottom of a page, clicks on links to other websites, and file downloads.

Outside Europe, Google Analytics saves two cookies in your browser: _ga and one that starts with _ga_. They hold a random ID and last up to two years. In the European Union, Iceland, Liechtenstein, Norway, the United Kingdom and Switzerland, it runs without cookies and saves no ID. Google’s ad features are off.

We never send search words, plan contents, the names of your files, or coordinates. We do not record your screen. We do not track every click.

The data goes to Astro Atomica’s PostHog project and Google Analytics account. Both companies are in the United States.

If your browser sends Do Not Track or Global Privacy Control, we send nothing. A widget on another website cannot see the choice you make here. To stop it there, use those browser settings.

Turning analytics off stops new data and removes the Google Analytics cookies. It does not delete data we already sent.

Analytics are off.