Skip to content

Why Ship a CEM?

Besides your components, the Custom Elements Manifest (CEM) is the most important thing you can ship in a web component library. It is a standardized JSON file that describes every custom element in your package: tag names, attributes, properties, methods, events, slots, CSS parts, CSS custom properties, and more.

Shipping that file means your consumers, and the tools they use, no longer have to guess how your components work by reading source or trial and error.

What a CEM contains

The Custom Elements Manifest schema serializes everything about your components into one custom-elements.json file:

  • Tag names and the classes that define them
  • Attributes, properties, and the types they accept
  • Methods and their signatures
  • Events, slots, CSS parts, CSS custom properties, and custom states
  • Descriptions, deprecation notices, and other JSDoc metadata

Because the format is a shared standard, any tool that understands the schema can use your manifest without custom work on your end.

Why your users need it

Documentation

A CEM can power API reference pages that are always in sync with the code. Web Awesome’s documentation is an example of API docs generated from component metadata rather than written by hand.

You can generate a changelog that detects added, removed, and breaking changes between versions and a lazy loader that generates one entry point for on-demand loading.

Editor and IDE support

Editors can read the manifest to offer autocomplete, hover documentation, and attribute suggestions inside HTML and templates. Tooling such as VS Code, JetBrains IDEs, Neovim, and Zed IDE integrations can use the same file your docs use.

Framework integrations

Teams rarely use a library in only one framework. Your React team, Vue team, and Svelte team may each need something different. When your library ships a CEM, those teams can generate their own framework wrappers or type definitions without waiting for you to build and publish them.

You can generate and ship wrappers (React, Angular, or Blazor), types (Vue.js, Svelte, or JSX), or helpers (ASP.NET Tag Helpers) with your library, or teams can create them locally. Either way, the CEM is the tool to help automate these integrations.

Stories

Storybook uses the manifest to build stories for your components, so controls, argument tables, and docs pages reflect the same metadata your consumers see.

Custom tooling

Your consumers may have needs you did not anticipate: a linter rule, a code generator, an internal design-system audit, or a migration script. The CEM gives them a stable, documented input for building that tooling.

Ship it with your package

A manifest is most useful when consumers can find it. Two practices help:

  1. Publish the file in your npm package, not just in your repository.
  2. Reference it from package.json with the customElements field so tools can locate it automatically:
    {
    "name": "@acme/components",
    "customElements": "dist/custom-elements.json"
    }

Generate the manifest as part of your build so it never falls behind the source.

Choosing components with a CEM in mind

When you are choosing a library or framework for authoring custom elements, check whether it can generate a CEM. This is especially important if your components will be used by other teams. A library that cannot produce a manifest pushes that cost onto every consumer who needs one.