Backstage
    Preparing search index...
    • Creates a new extension input to be passed to the input map of an extension.

      Type Parameters

      • UExtensionData extends ExtensionDataRef<unknown, string, { optional?: true }>
      • TConfig extends { internal?: boolean; optional?: boolean; singleton?: boolean }

      Parameters

      • extensionData: UExtensionData[]

        The array of extension data references that this input expects.

      • Optionalconfig: TConfig & { replaces?: { id: string; input: string }[] }

        The configuration object for the input.

      Returns ExtensionInput<
          UExtensionData,
          {
              internal: TConfig["internal"] extends true ? true : false;
              optional: TConfig["optional"] extends true ? true : false;
              singleton: TConfig["singleton"] extends true ? true : false;
          },
      >

      An extension input declaration.

      Extension inputs created with this function can be passed to any inputs map as part of creating or overriding an extension.

      The array of extension data references defines the data this input expects. If the required data is not provided by the attached extension, the attachment will fail.

      The config object can be used to restrict the behavior and shape of the input. By default an input will accept zero or more extensions from any plugin. The following options are available:

      • singleton: If set to true, only one extension can be attached to the input at a time. Additional extensions will trigger an app error and be ignored.
      • optional: If set to true, the input is optional and can be omitted, this only has an effect if the singleton is set to true.
      • internal: If set to true, only extensions from the same plugin will be allowed to attach to this input. Other extensions will trigger an app error and be ignored.
      const extension = createExtension({
      attachTo: { id: 'example-parent', input: 'example-input' },
      inputs: {
      content: createExtensionInput([coreExtensionData.reactElement], {
      singleton: true,
      }),
      },
      output: [coreExtensionData.reactElement],
      *factory({ inputs }) {
      const content = inputs.content?.get(coreExtensionData.reactElement);
      yield coreExtensionData.reactElement(<ContentWrapper>{content}</ContentWrapper>);
      },
      });