schema-components - v3.7.0
    Preparing search index...

    Function registerSchemaComponents

    • Register every built-in <sc-*> Custom Element on the global customElements registry, optionally namespaced under prefix.

      Re-registering the same tag is a no-op — customElements.get(tag) is checked first so calling this function twice (or alongside another library that registered the same tag) does not throw.

      Parameters

      • prefix: string = ""

        Optional prefix prepended to every built-in tag. E.g. registerSchemaComponents("myapp-") registers <myapp-sc-string>, <myapp-sc-number>, …, avoiding collisions with another library that may have shipped its own <sc-*> elements. Pass an empty string (the default) to use the canonical names.

      Returns RegistrationResult

      A RegistrationResult carrying the canonical-tag → registered-tag map and the list of elements skipped because the tag was already registered. The map is used by the default resolver to look up the right tag when the consumer chose a custom prefix.

      // Default registration — tags are <sc-string>, <sc-number>, ...
      import { registerSchemaComponents } from "schema-components/lit/registry";
      const tags = registerSchemaComponents();

      // Namespaced registration — tags are <myapp-sc-string>, ...
      const namespaced = registerSchemaComponents("myapp-");