The essentials

Block architecture

Content first. Behavior second.

The HTML contract

EDS-compatible blocks use rows and columns. The first class identifies the registered block. Additional classes select supported variants.

<div class="accordion bordered">
  <div>
    <div>A question</div>
    <div>A meaningful answer, visible without JavaScript.</div>
  </div>
</div>

Progressive enhancement

Every block exports default function decorate(block). The accordion moves existing content into native details and summary elements. Tabs add ARIA relationships, roving focus, and arrow-key support. No block imports the standalone runtime.

Runtime lifecycle

import { configure, loadEager, loadLazy, loadDelayed } from './runtime/loader.js';
configure({ base: './' });
await loadEager(document);
const stopLazy = loadLazy(document);
const stopWatching = loadDelayed(document);
// For applications that remove the page:
// stopLazy?.(); stopWatching();

Mark above-the-fold blocks with data-loading="eager". The loader deduplicates modules and styles, tracks data-block-status, and emits block:loaded or block:error. Authored content remains on errors. Only registered names are discovered.

Cleanup

Decorators can return a cleanup function. The runtime exposes destroyBlock(block) to remove registered listeners. Call it before removing a dynamically mounted block.

Edit this page on GitHub

Search documentation

Search the docs, components, and blocks. Use Tab to select a result.