Renderer specification

TypeScript type: CustomRendererSpecification.

This specification allows defining a custom renderer, which can be used to render properties or categories.

Attributes

Name Required? Type Default
rendererName Yes string

Attribute: rendererName

Name of the renderer that's going to be used in UI components. Value of this attribute corresponds to RendererDescription.name attribute that gets assigned to whatever the renderer is set on.

Type string
Is Required Yes
// There's a content rule for returning content of given `bis.Subject` instance. In addition,
// it assigns the `CodeValue` property a custom "my-renderer" renderer.
const ruleset: Ruleset = {
  id: "example",
  rules: [
    {
      ruleType: "Content",
      specifications: [
        {
          specType: "SelectedNodeInstances",
          propertyOverrides: [
            {
              name: "CodeValue",
              renderer: {
                rendererName: "my-renderer",
              },
            },
          ],
        },
      ],
    },
  ],
};
// Ensure the `CodeValue` field is assigned the "my-renderer" renderer
const content = (await Presentation.presentation.getContentIterator({
  imodel,
  rulesetOrId: ruleset,
  keys: new KeySet([{ className: "BisCore:Subject", id: "0x1" }]),
  descriptor: {},
}))!;
expect(content.descriptor.fields).to.containSubset([
  {
    label: "Code",
    renderer: {
      name: "my-renderer",
    },
  },
]);

Last Updated: 03 April, 2024