The essentials

Creating blocks

Keep the contract. Make it yours.

Start with content

Create blocks/my-block/my-block.html with useful authored content. Without JavaScript, the user should still get the information.

Add a decorator

export default function decorate(block) {
  block.querySelectorAll('a').forEach((link) => {
    link.classList.add('button');
  });
}

Scope your styles

.my-block {
  padding: 2rem;
  color: var(--foreground);
  background: var(--muted);
  border-radius: var(--radius);
}

Register it

Add the name, title, description, category, variants, and folder to registry/catalog.js, and add the name to the standalone runtime configuration. Run the registry build to generate distributable JSON. Never edit generated registry source contents.

Before contributing

Check multiple instances, malformed rows, repeat decoration, keyboard access, narrow viewports, dark mode, and reduced motion. Add focused tests and a clear authoring example.

Edit this page on GitHub

Search documentation

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